View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default If cell is empty then run macro otherwise skip this macro

Don't you want to always run macro1, but you sometimes want to run macro2
first:


if Range("Q4").Value = "" then
macro2
End if
macro1

or to check all the cells in Q4:Q14:

if application.CountA(Range("Q4:Q14")) = 0 then
macro2
End if
macro1

--
Regards,
Tom Ogilvy


" wrote:

Hi -
I have a ton of data that I have built a macro (Macro 1) for assuming
that all the data was going to be in the same location in each
spreadsheet. Of course it turns out some sheets are different but they
are all different in the same way. So, I built another macro (Macro2)
that moves the data back over to correspond with Macro1 but now I need
another macro that will decide whether or not Macro 2 needs to be run.

So the sheets with the data in the wrong location all have column Q4-14
blank and the columns are not blank in the correct data... so the macro
needs to say something like this:

If the cell.value of Q4 = blank, then run macro 2, otherwise run macro1

Sorry, I know this is easy but I can't figure it out. Any help would be
appreciated.

Thanks
Alex