Please help with my code
I have the following code:
Elseif Activeworkbook.sheets.names = "Sheet 1" Then
Sheets("Sheet 1").Delete
Basically, I have Workbook A and Workbook B. In Workbook A, I created a
user form with various functionalities, and the code above is part of the
user form. When I open Workbook A in the same instance as Workbook B, the
user form will open on the Workbook B. When I click on any button on the
user form, the code will execute on Workbook B.
The purpose of the code above is to check whether "Sheet 1" exists in
Workbook B. If exist, delete "Sheet 1". I am having problem with the code
(Elseif Activeworkbook.Sheets.Names = "Sheet 1" Then) to check whether "Sheet
1" exists.
Can someone help me with the code? Below is the structure of my entire code:
Private Sub cmdTest_Click()
If ....... Then
.......
Elseif Activeworkbook.Sheets.Names = "Sheet 1" Then
Sheets("Sheet 1").Delete
Else
........
End If
End Sub
Thanks.
|