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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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