Excel 2013 worksheet activate

mce7171

New Member
Joined
Sep 13, 2013
Messages
3
Hi,

I have an issue with activating a sheet from a user form, the same code works fine in Excel 2003 to Excel 2010, doesn't work with Excel 2013.

This is how to simply reproduce the issue:

Have a workbook with 2 worksheets in it, called Sheet1 and Sheet2 let's say, and some different data in both sheets, in same cells, to observe the issue better, and on Sheet1 have 2 buttons:

On click of Button1 activate Sheet2 worksheet using a Macro1 with 1 line in it:
ThisWorkbook.Sheets("Sheet2").Select

I can edit data in Sheet2 fine in this situation.

On click of Button2 call Macro2 which has 1 line:
UserForm1.Show

a UserForm1 pops up and on click of a CommandButton1 call same Macro1 like this:
Unload Me
Macro1

the Sheet2 worksheet is activated, sort of, but if I edit data in it, it actually updates corresponding cells in Sheet1, if I click on Sheet1 I can see data entered in there!
I tried also with Activate method instead of Select, same result, works fine for older Excel version, doesn't work with 2013.

Clicking back from Sheet1 to Sheet2 worksheet activates the Sheet2 sheet properly.

Has anyone seen such behaviour? If yes, are there any coding workarounds to properly activate Sheet2?

Thank you
 
Try editing your Userform.show to:
Userform.show vbModeless

I was having a really tough time trying to figure out what was wrong, but this fixed it for me for some reason.

Wow, spend an hour searching before i found this awnser. It fixes my problem. Thanks!
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,215,767
Messages
6,126,772
Members
449,336
Latest member
p17tootie

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