ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If cell is empty then run macro otherwise skip this macro (https://www.excelbanter.com/excel-programming/364005-if-cell-empty-then-run-macro-otherwise-skip-macro.html)

[email protected]

If cell is empty then run macro otherwise skip this macro
 
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


[email protected]

If cell is empty then run macro otherwise skip this macro
 
Or I guess it can say
If cell.value of Q4=blank then go to next step, otherwise stop this
macro


Tom Ogilvy

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



[email protected]

If cell is empty then run macro otherwise skip this macro
 
Thank you very much Tom. You're great!



All times are GMT +1. The time now is 03:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com