Nicholas
Nicholas

Reputation: 2668

How do I set ActiveSheet in ActiveWorkbook as the window on the top of the screen?

I attempted to run a UserForm that collects data from Workbook("A") and outputs result to either to Workbook("A") or Workbook("B")(a different one).

If the result is sent to Workbook("B"), I would use Workbook("B").Activate, Sheets(1).Activate.

But after the UserForm is unloaded and the macro is completed, I am still in the Workbook("A"), even though the title of the workbook is shaded (which means that Workbook("A") is not AciveWorkbook).

How do I bring the real ActiveWorkbook Workbook("B") to the top of my computer screen?

Upvotes: 0

Views: 531

Answers (1)

Subodh Tiwari sktneer
Subodh Tiwari sktneer

Reputation: 9966

This should work for you.

Dim wb1 As Workbook, wb2 As Workbook
Set wb1 = Workbooks("A")
Set wb2 = Workbooks("B")
wb2.Sheets(1).Activate

Upvotes: 1

Related Questions