before double click vba help

Sarah_Lou0607

New Member
Joined
Nov 8, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the below code currently to hyperlink to a hidden page. This works at the moment but I'm not sure how to add in another link?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If ActiveCell.Address = "$I$6" Then
Worksheets("inc Priorities").Visible = True
Worksheets("inc Priorities").Activate
Else
'do nothing

End If
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi & welcome to MrExcel.
How about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   Select Case Target.Address(0, 0)
      Case "I6"
         With Worksheets("inc Priorities")
            .Visible = xlSheetVisible
            .Activate
         End With
      Case "I7"
         With Worksheets("Main")
            .Visible = xlSheetVisible
            .Activate
         End With
   End Select
End Sub
 
Upvote 0
perfect thank you! also need code so that once I get back to the main sheet, it rehides those sheets again?
 
Upvote 0
You could put something like his on those sheets
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Target.Address(0, 0) = "A1" Then
      Sheets("Main").Activate
      Me.Visible = xlSheetHidden
   End If
End Sub
 
Upvote 0
Sorry very much a beginner so a lot of this is way over my head (Any tips on how to learn welcome, as I'd love to but don't know where to start!)

I have shapes as buttons on the sheets to Return to main page so don't think the beforedoubleclick would apply here (sorry to jump to another type!)
I have macros assigned to the shapes with vba code to take me to relevant pages.

So once the macro shape takes me to the main page, I'm wondering how I get it to hide all sheets except for Main.

Hope that makes sense! Reallyyy appreciate your help!
 
Upvote 0
How about
VBA Code:
Sub SarahLou()
   Dim Ws As Worksheet
   
   For Each Ws In Worksheets
      If Ws.Name <> "Main" Then Ws.Visible = xlSheetHidden
   Next Ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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