#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Count macro

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Count macro

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
---------------
Jacob Skaria


"nbhp" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default Count macro

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

Activesheet.Tab.Colorindex = 3
End If

--
__________________________________
HTH

Bob

"nbhp" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Lookup Count Rbirdie Excel Discussion (Misc queries) 0 March 24th 09 07:39 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro with count if orquidea Excel Discussion (Misc queries) 2 December 14th 07 03:12 AM
Why is my macro changing sum to count? punter Excel Discussion (Misc queries) 2 June 21st 06 09:51 PM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"