Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default If cell is empty then run macro otherwise skip this macro

Thank you very much Tom. You're great!

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 PASTE CELL to COLUMN, SKIP ROWS Dan Excel Discussion (Misc queries) 1 February 2nd 10 01:03 PM
How do I skip a blank cell within macro? DJ Dusty[_6_] Excel Programming 3 March 20th 06 11:17 PM
Macro to run if cell empty Greg[_20_] Excel Programming 15 April 15th 05 08:01 PM
macro to look for empty cell esrei Excel Discussion (Misc queries) 1 April 14th 05 11:57 AM
How to skip empty cells while running a macro? saziz[_2_] Excel Programming 5 June 10th 04 11:16 PM


All times are GMT +1. The time now is 04:03 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"