Results 1 to 3 of 3
  1. #1
    Azri1
    Guest

    Could someone please fix this code for me..thanks.

    Could someone please fix this code for me..thanks..
    When I run it...I get an error..I'm using Excel 97


    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Worksheets("Macros Not enabled").Visible = True
    for Each ws In Worksheets
    If ws.Name <> "Macros Not Enabled" Then ws.Visible = xlVeryHidden
    Next
    End Sub

    Private Sub Workbook_Open()
    For Each ws In Worksheets
    If ws.Name <> "Macros Not Enabled" Then ws.Visible = True
    Next
    Worksheets("Macros Not Enabled").Visible = xlVeryHidden
    End Sub

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Could someone please fix this code for me..thanks.

    Change the line Worksheets("Macros Not enabled").Visible = True to Worksheets("Macros Not Enabled").Visible = True, and it should work. Upper and lower case do make a difference in worksheet names. You can have a sheet named Macros Not enabled and a sheet named Macros Not Enabled in the same work book.

    Andrew

  3. #3
    Azri1
    Guest

    Re: Could someone please fix this code for me..thanks.

    thanks again andrew..you always help me.regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •