• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Can I have one Macro for the whole workbook instead of one on each worksheet

Status
Not open for further replies.
I have a workbook with 25 pages currently though this will increase as time progresses.

Each page has two Macros. They are the same on each page.

They are proving very hard to identify when I try an run them because they are identified as Sheet 1,Sheet 2 etc and the sheets all have the dates as names.

Is it possible to have one macro that will work for the whole book allowing me to just hide all the sheets I need to do.

This is on each page at present.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count = 1 Then
        If Not Intersect(Target, [F3]) Is Nothing Then
            Select Case UCase(Target)
                Case "MEDAL"
                    [X1].EntireColumn.Hidden = True
                    [AB1].EntireColumn.Hidden = False
                    [AE1].EntireColumn.Hidden = True
                Case "SCRAMBLE"
                    [X1].EntireColumn.Hidden = True
                    [AB1].EntireColumn.Hidden = False
                    [AE1].EntireColumn.Hidden = True
                Case "STABLEFORD"
                    [X1].EntireColumn.Hidden = False
                    [AB1].EntireColumn.Hidden = True
                    [AE1].EntireColumn.Hidden = True
                Case "PAR"
                    [X1].EntireColumn.Hidden = True
                    [AB1].EntireColumn.Hidden = True
                    [AE1].EntireColumn.Hidden = False
                Case Else
                    [X1].EntireColumn.Hidden = False
                    [AB1].EntireColumn.Hidden = False
                    [AE1].EntireColumn.Hidden = False
            End Select
        End If
    End If
End Sub
Sub Hide_Columns()
  Range("I:J,N:W, Y:AA,AC:AD").EntireColumn.Hidden = True
End Sub

I know very little about VBA/Macros and googled to get this code.
 
Certificates!
You seems to duplicate Your thread with new Title.
You can continue with Your original thread,
which has a solution too.
This thread is closed now.
 
Status
Not open for further replies.
Back
Top