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
|