View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default If Statement to run a macro


=if(A1=0,Mycount(A1:B100),"")

sub Mycount(Target as Range)
MyCount = 0
for each cell in Target
Mycount = Mycount + cell.value
next cell

end sub

"Secret Squirrel" wrote:

How would I create an IF statement to fire a VBA macro? I want to be to run
the macro if a cell value = "0".