FalconFlyer
New Member
- Joined
- May 18, 2015
- Messages
- 30
I have a userform in a workbook A that I can click on a button to open another workbook (B). When I am done editing Workbook B, I want to save and close. Excel will not let me until I close the userform in Workbook A. I want to leave the userform open as I will need it to do other things and has input boxes that I do not want to keep retyping. Is there something specific I should be adding to my code?
TIA
TIA
Code:
Private Sub CommandButton1_Click()
Dim wb As Workbook
Dim staff_eval As String
Dim emp_name As String
Dim Actsheet As String
Dim LastRow As Long
txt = TextBox1.Text
staff_eval = "file.xlsm"
'~~> open the workbook
Set wb = Workbooks.Open(staff_eval)
LastRow = Sheets("Summary").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Summary").Unprotect ""
Application.ScreenUpdating = False
On Error Resume Next
Sheets("Template").Visible = True
Sheets("Template").Copy _
after:=Sheets("Template")
ActNm = ActiveSheet.Name
ActiveSheet.Name = txt
Sheets(ActiveSheet.Name).Visible = True
ActiveWorkbook.Sheets("Template").Visible = False
Sheets("Summary").Range("A" & (LastRow + 1)).Value = ActiveSheet.Name
Sheets("Summary").Protect ""
Application.ScreenUpdating = True
End Sub