VBA runs from developer but wont run from icon

graudales

New Member
Joined
Nov 9, 2015
Messages
19
Hello Everybody and thank you for your help in advance, I love Mr. excel.
Well I have done way more complex codes than this one but i hit the wall. I recorded a macro that hides current sheet and goes to main menu sheet, it runs fine when i open and run it with the developer but when I click the icon just jumps from one sheet to anotherone withot hidint the sheet. Is making me crazy cause is fine but why ust the go to order works but not the part of hiddind the sheet?
here is the code; I am sure I am missing some kind of simple setting and I cannot comprehend what is it, I havent been working for over 5 years and I am rusted.. any comment would be very welcome.


Sub Macro2()

Sheets("Chewy Private Label").Select
Sheets("chewy Private Label").Visible = False
Sheets("Menu Home").Select
Range("A10").Select
End Sub
Sub Macro3()

Sheets("Menu Home").Select
Sheets("Chewy Private Label").Visible = True
Sheets("Chewy Private Label").Select
Range("A6").Select
End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I've never used shapes with macros my self and wasn't aware you could so you have taught me something.
the below is what i use on my sheets but if you don't want people to be able to right click and unhide the sheets manually i would use =xlSheetVeryHidden

Worksheets("Chewy Private Label").Visible = xlSheetVisible
Worksheets("Menu Home").Visible = xlSheetHidden

Worksheets("Menu Home").Visible = xlSheetVisible
Worksheets("Chewy Private Label").Visible = xlSheetHidden
 
Upvote 0
Works on mine. I inserted two shapes, a rectangle and a circle, and assigned a macro to each. Since I don't have sheet names like yours, I just use index number. The macro hid and unhid sheets. I didn't check range.select behavior.

VBA Code:
Sub Macro2()

Sheets(3).Select
Sheets(3).Visible = False
Sheets(1).Select
Range("A10").Select
End Sub
Sub Macro3()

Sheets(1).Select
Sheets(3).Visible = True
Sheets(3).Select
Range("A6").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

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