Ignoring a Macro when "Save as"

L

Lovelock, David

I have a Workbook with the following macro. I want to let the user "Save
As" and rename the workbook and not have the macro take place when the
newly named workbook gets re-opened. Anyone have any ideas?


Here is the current macro, nothing fancy just setting some default
values upon opening the workbook:

Private Sub Workbook_Open()
With Sheets("Fab Sheet")
..Range("E15,E18,E22,E26,E30,E37,E43").Value = 1
..Range("A11,B11,A13,B17,C27,C31,B35,B41,B50,B52,C55").Value = 0
..Range("B3..B8").Value = ""
End With
End Sub

The macro is located on the ThisWorkbook area.
 
J

J.E. McGimpsey

While it's not the cleanest way, putting this as the first line of
your code:

If Me.Name <> "MyName.xls" Then Exit Sub
 
Top