fixing error run time error 1004 to hide specific sheets

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello
i have this code trying hide specific sheets but it gives me error run time error 1004 "method visible of object_ worksheet failed " in this line
VBA Code:
sh.Visible = xlSheetVeryHidden

VBA Code:
Private Sub CommandButton2_Click()
Application.Visible = True
Sheets("micro").Activate
Dim sh As Worksheet

For Each sh In Worksheets(Array("RAW", "Date", "MICC", "REPORT", "LABLE"))
    sh.Visible = xlSheetVeryHidden
Next sh
UserForm1.hide

End Sub
i truly appreciate if anybody help
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
In post#6 dmt32 had forgotten to change the name of the first sheet in the array from Raw to Micro.
 
Upvote 0
sorry about it i don't note that because i amended my code in post 4# not 6#
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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