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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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