Userform to stay open in a different sheet while editing

JLouis

Board Regular
Joined
Jan 1, 2004
Messages
181
Office Version
  1. 365
Platform
  1. Windows
Hello. My challenge today it to successfully code the following:
I have 2 WB's, say WB1 & WB2
While using WB1 I use code to go to and work on WB2. I need a visible, floating button that I can click in WB2 to return seamlessly back to WB1.

I've tried several bits of code to open a userform in another workbook without satisfactory results.

Any suggestions would be appreciated.

Louis
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,400
Office Version
  1. 365
Platform
  1. Windows
Do you mean like this:

VBA Code:
UserForm1.Show vbModeless
 

JLouis

Board Regular
Joined
Jan 1, 2004
Messages
181
Office Version
  1. 365
Platform
  1. Windows
Yes. That is the macro to show in WB2. It is called from WB1 but is not working properly. There are actually 2 separate macros called in WB2. The first macro calls a specific page in WB2 to open, the 2nd one calls the userform.

Sub CallAnotherMacro()

Application.Run "'Another Workbook.xlsm'!NameOfMacro"

End Sub

I guess I need to be able to call 2 different macros in WB2.

Thank you for the reply.
 

JLouis

Board Regular
Joined
Jan 1, 2004
Messages
181
Office Version
  1. 365
Platform
  1. Windows
To bring this discussion full circle, this is the macro calling the first procedure:
Sub mon_o()
'

On Error GoTo ErrorHandler
Windows("276 Scheduling Program.xlsm").Activate
Application.Run "'276 Scheduling Program.xlsm'!MONDAYTemplate"
Exit Sub
ErrorHandler:
MsgBox ("The 276 Scheduling Program is not open. Please open the file and rerun the macro.")

End Sub

This works properly. So now I want to create a button that shows on the 2nd workbook that, when pressed, will take me back to the original WB. Sorry I haven't expressed myself properly.
 

JLouis

Board Regular
Joined
Jan 1, 2004
Messages
181
Office Version
  1. 365
Platform
  1. Windows
SOLVED:
Not sure why this is working now, but the answer to my problem was the code shown below. I wrote the TestByWorkbookName a little different on WB2.

Sub mon_o()
'
On Error GoTo ErrorHandler
Windows("276 Scheduling Program.xlsm").Activate
Application.Run "'276 Scheduling Program.xlsm'!MONDAYTemplate"
Application.Run "'276 Scheduling Program.xlsm'!TestByWorkbookName"
Exit Sub
ErrorHandler:
MsgBox ("The 276 Scheduling Program is not open. Please open the file and rerun the macro.")

End Sub
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,130,015
Messages
5,639,558
Members
417,098
Latest member
steverob

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
Top