LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default IF Statement in Macro

I have a macro that opens workbooks. The paths for the workbooks are
contained in various cells, say Cell A1 contains the path for Workbook1, Cell
A2 contains the path to Workbook2, and Cell A3 contains the path to
Workbook3, and so on, and the macro opens the files that are specified in
each of the cells. However, some of the cells on which the macro operates
are blank, which creates an error.

Im trying to use an IF statement to have the macro skip over the blank
cells, and thus avoid an error, but have had no luck so far. My co-worker
suggested using the following code:

If Range("A1").Value = "" then Goto 2
[Code to open file contained in Cell A2]
End IF
1:
[Macto to open file contained in A1]
End Sub

However, this code generates the following error :"End if without block IF"

Any advice you could give me on overcoming the problem would be greatly
appreciated?

Magnivy

 
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
If statement in macro orquidea Excel Discussion (Misc queries) 2 May 11th 08 08:19 PM
If and then statement macro George Excel Programming 4 March 14th 06 08:05 AM
Run Macro From If Statement tkaplan[_2_] Excel Programming 0 June 3rd 05 06:31 PM
IF statement in a macro iamn94 Excel Programming 1 April 17th 05 03:17 AM
can i use an IF Statement to run a macro? Davidrowland88 Excel Worksheet Functions 2 February 11th 05 12:45 PM


All times are GMT +1. The time now is 08:24 AM.

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

About Us

"It's about Microsoft Excel"