Results 1 to 2 of 2
Thread: IF then on filename (2003)
2008-05-06, 18:22 #1
- Join Date
- Feb 2006
- Thanked 0 Times in 0 Posts
IF then on filename (2003)
On worksheet open, want to jump to section of code if filename does not match specific name.
I have master worksheet with code that blanks specific cells when opened. Users open master, complete input, and then "save as" under different name to their desktop. When user re-opens their file, look at open filename and skip cell blanking if it does not match Master filename.
2008-05-06, 18:34 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: IF then on filename (2003)
You could do the following:
- Press Alt+F11 to activate the Visual Basic Editor.
- Double-click the ThisWorkbook item for the workbook in the Project Explorer on the left hand side.
- Enter or copy/paste the following code:
Private Sub Workbook_Open()
If Not ThisWorkbook.Name = "SpecificName.xls" Then
' Code to blank cells here
' Or call a macro that does that
Change the name to the one you want.
However, this is not very secure: if the user doesn't enable macros when opening the workbook, the code will not run.