Userform called in macro

rishabhgupta

New Member
Joined
Jan 21, 2014
Messages
2
Hi,

i have created some textboxes and assigned different macro to them.
i have created these text boxes to call different sheets.
same userform has been called to different macros, userform contains two button 'ok' and 'cancel'.
i need to activate sheet by clicking 'ok' in userform and the name of the sheet that got activated should be same as text in the box.
how to write code in 'ok' button so that it recognize which text box has called this userform..

Thanks
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Depending on what the code does that is attached it is unnecessary to actually activate worksheets for the code to work.
 
Upvote 0
Depending on what the code does that is attached it is unnecessary to actually activate worksheets for the code to work.

But i want to open that sheet by clicking Ok button on userform.
can i declare a global variable in module and assign a value to this variable inside macro, this macro is called when i click on button.
then using this variable can i activate sheet??

I am totaly new to VBA. please help..
 
Upvote 0
You've already been asked to provide a link to your workbook.

However, the best way is to forget about TextBoxes and use a Listbox to list all the sheets in the workbook.

Example WorkBook
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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