VBA help

MrKidski

New Member
Joined
Apr 12, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello! I'm trying to track some tasks for some people that are helping me and was trying to figure out the best way to do it from an excel sheet. The task is in one cell and their name is in the cell next to it and then they highlight the cell with their name when it is complete. I was trying write some VBA to help count the highlighted cells and the non highlighted cells as they worked them but when we use it, excel acts like it is going to crash with every adjustment we make. Is there a better way to write this?


This is what I have so far:

Function CountColor(range_data As Range, criteria As Range) As Long

Dim datax As Range

Dim xcolor As Long

xcolor = criteria.Interior.ColorIndex

For Each datax In range_data

If datax.Interior.ColorIndex = xcolor And _

datax.Value = criteria.Value Then

CountColor = CountColor + 1

End If

Next datax

End Function
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Welcome to the Board!

How many CountColor formulas do you have on your sheet?
How big of a range are you referencing in your CountColor formula?
Please show us an example of how you have written this formula on your sheet.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top