Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
What this code is suppose to do is look to see if any of the worksheet names equals Exhibit "I" or "page 2". If they do exist then before closing the workbook don't save it and then close the workbook.
Actual First Worksheet Name is Exhibit "I" and the second worksheet name is page 2.
Unfortunately, I am getting a compile error: Variable not defined and the following word "Worksheet" is highlighted in blue.
Full Code Below:
Thank You
Actual First Worksheet Name is Exhibit "I" and the second worksheet name is page 2.
Unfortunately, I am getting a compile error: Variable not defined and the following word "Worksheet" is highlighted in blue.
Code:
If [COLOR=#0000FF][B]Worksheet[/B][/COLOR].Name = ("Exhibit 'I'") Or ("page 2") Then
Full Code Below:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheet.Name = ("Exhibit 'I'") Or ("page 2") Then
ThisWorkbook.Save = False
ThisWorkbook.Close
End If
End Sub
Thank You
Last edited: