Hide Another Workbook Worksheet

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
Hello Everyone

In A1 i have a path d\temp\action.xlsm

Action.xlsm Workbook has a worksheet by the name of secret

Right now in current open active workbook.. name sample.xlsm. i have a button. I want if i click on that button action.xslm worksheet would be hide. In simple i want to hide secret worksheet from the excel file name mentioned in A1.

Pls help
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Assign this macro to your button.
Sub HideSheet()
Application.ScreenUpdating = False
Dim wbOpen As Workbook
Set wbOpen = Workbooks.Open("D:\temp\action.xlsm")
Sheets("secret").Visible = False
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks for your response..

Instead of path i need range a1... ..

Kindly provide me updated code.. it would help me
 
Upvote 0
Maybe
Code:
Sub Rahulwork()
   Dim Wbk As Workbook
   
   Set Wbk = Workbooks.Open(Range("A1").Value)
   Wbk.Sheets("secret").Visible = False
End Sub
 
Upvote 0
thank you so much its working but by this code file mentioned in path is opening.

can we keep that close and save.
 
Upvote 0
To save & close use
Code:
Sub Rahulwork()
   Dim Wbk As Workbook
   
   Set Wbk = Workbooks.Open(Range("A1").Value)
   Wbk.Sheets("secret").Visible = False
   Wbk.Close True
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,961
Messages
6,175,652
Members
452,664
Latest member
alpserbetli

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