Hi! I have a "report workbook" with a macro that opens several other existing workbooks, copies data and creates a report on a new worksheet in the "reports workbook". It creates the report fine. While the macro runs, I implement a "progress form" to let me know what the code is doing ("Reading file 1", etc). The report macro ends like this:
I then close the "progress form" with an Ok button:
The report is the active/viewable worksheet after I click Ok, but if I edit a cell, it will edit a different worksheet in the workbook (the one I use to initiate the process). This isn't viewable when I make the edit, but if I select that worksheet, I can see the change I made. I can resolve this by clicking another worksheet, and then coming back to the report page. What can I do to correctly activate the report page when the macro completes?
Code:
targetWb.Activate
targetWs.Activate
targetWs.Cells(1, 2).Select
progLine1 = progLine1 & vbLf & "Done!"
progressForm.line1.Caption = progLine1
DoEvents
I then close the "progress form" with an Ok button:
Code:
Private Sub okButton_Click()
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Unload progressForm
End Sub
The report is the active/viewable worksheet after I click Ok, but if I edit a cell, it will edit a different worksheet in the workbook (the one I use to initiate the process). This isn't viewable when I make the edit, but if I select that worksheet, I can see the change I made. I can resolve this by clicking another worksheet, and then coming back to the report page. What can I do to correctly activate the report page when the macro completes?