Ignoring a Macro when "Save as"

  • Thread starter Thread starter Lovelock, David
  • Start date Start date
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.
 
While it's not the cleanest way, putting this as the first line of
your code:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top