Select sheet from form

Hatye

Board Regular
Joined
Jan 11, 2010
Messages
143
Hi,

I have a user form that are supposed to open a worksheet. I use
Code:
Private Sub CommandButton2_Click()

Sheets("Rapport_Linjer").Select


Me.Hide


End Sub
to open the proper sheet, but changes made in this sheet are made in the sheet where the form was opened, although I'm currently seeing correct sheet (selected from the user form).

Do I also need to activate the selected sheet, or is there any thing else I need to think of?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
That piece of code will select the sheet in question then hide the userform. There is nothing there that makes any changes to any sheets.
 
Upvote 0
Hi steve the fish,

I'm sorry if I was unclear. I want the macro above (which is assigned to an button in an user form) to select/show the proper worksheet (which works).
When the macro is done, the selected sheet is shown, and I then want to make all necessary changes manually in the sheet.

The problem is that I can see the selected sheet after the macro was run, but the changes I do in this sheet isn't done in the one I see. If I go back to the sheet I run the user form from, I can see that all changes are done in that sheet.
 
Upvote 0
Sorry no idea what you mean. Once you have run that macro the sheet you will see will be sheet named 'Rapport_Linjer'. You can type happily in that sheet. It wont transfer that to another sheet unless you have more code elsewhere telling it to do that.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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