VBA Still Running

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



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
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Make your form modeless when you load it:
Code:
frmMyForm.Show vbModeless
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top