Count macro

N

nbhp

I have 2 columns of data (A3:A100 and H3:H100) and wish to count the number
of non-blank cells in each range, then compare the totals. If the totals are
equal then the tab for the worksheet will change colour, say red. I have not
really used the count function before and all attempts so far have failed.

Anyones help would be greatly appreciated.

Many Thanks
 
J

Jacob Skaria

Try the below macro which works on the activesheet

Sub CountBlanksColorTab()
If WorksheetFunction.CountBlank(Range("A3:A100")) = _
WorksheetFunction.CountBlank(Range("H3:H100")) Then
ActiveSheet.Tab.ColorIndex = 3
Else
ActiveSheet.Tab.ColorIndex = -4142
End If
End Sub

If this post helps click Yes
 
B

Bob Phillips

If Application.Counta(Range("A3:A100")) =
Application.Counta(Range("H3:H100")) Then

Activesheet.Tab.Colorindex = 3
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top