Link to home
Create AccountLog in
Avatar of route217
route217Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Lunch user form from macro button

Hi Experts

I have the following code in Thisworkbook

Private Sub Workbook_Open ()
Worksheets("MO - Data").Activate
Userform1.show

End Sub

So the user form open on opening the WBk - I want to change so the user form operates from a macro button...and not when the workbook opens...
ASKER CERTIFIED SOLUTION
Avatar of redmondb
redmondb
Flag of Afghanistan image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of route217

ASKER

Hi Brian

Can you kindly paste the code here and where to put it... As I cannot access the experts exchange website from my current location - using iPhone...
In have requested attention on other question...
route217,

(1) Insert a new module.
(2) Move the  Workbook_Open macro to the new module - dropping the "Private" and renaming it to, say, "MyMacro".
(3) In the appropriate sheet, click on "Developer" in the Ribbon's menu bar. (If it's not visible I'll explain how to display it.)
(4) Click on "Insert".
(5) In the "Forms Control" section, click on the first icon ("Button").
(6) Draw your button on the sheet.
(7) If the "Assign Macro" dialogue is not displayed then right click on the button and click on "Assign Macro...".
(8) Select your macro and click on OK.
(9) Click on a cell.

(Thanks for sorting out the other question.)

Regards,
Brian.
Thanks and no problem ....

New question coming up
Quick question how do I find out what userfirm it is as userfirm one - is not correct as I have inserted another user form..
route217,

In the Project Explorer Pane in VBE (under the file's name) you'll see a number of entries. Expand the one for "Forms" and it'll list all of the file's forms. (Double-click an entry to see the form.)

Edit: Please see attached.

Regards,
Brian.User generated image
Thanks, route217.
Thanks brain

I have post a new question which is 90% similar to the excellent piece of work you created ...

See link...https://www.experts-exchange.com/questions/28027470/Macro-to-combine-data-of-selected-worksheet-same-workbook.html