MS OFFICE 2019 EXCEL VBA (Auto Hide every Sheets)

mundas26

New Member
Joined
May 17, 2023
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone!
Please help me to solve this problem. All i need is to hide all Sheets once i click the Main sheet. Here's my main sheets code.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
LinkTo = Target.SubAddress

WhereBang = InStr(1, LinkTo, "!")
If WhereBang > 0 Then
MySheet = Replace(Left(LinkTo, WhereBang - 1), "'", "")
Worksheets(MySheet).Visible = True
Worksheets(MySheet).Select
MyAdd = Mid(LinkTo, WhereBang + 1)
Worksheets(MySheet).Range(MyAdd).Select
End If
End Sub


Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Worksheets("KSA VM MOVEMENT").Select
Target.Parent.Worksheet.Visible = False
End Sub


tempsnip.png

1684313631046.png

1684313677976.png
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
You could add this event macro to the main sheet module. Once you click on the main sheet, all the other sheets will hide.
VBA Code:
Private Sub Worksheet_Activate()
    Dim ws     As Worksheet
    For Each ws In Worksheets
        If ws.Name <> "KSA VM MOVEMENT" Then ws.Visible = False
    Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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