+ Reply to Thread
Results 1 to 9 of 9

problem macro to show a warning sheet...

  1. #1
    quartz
    Guest

    RE: problem macro to show a warning sheet...

    Your code runs fine, the problem is you must have at least one visible sheet
    in a file. Add a blank sheet first, then hide the rest. Exclude the token
    visible sheet from your code.

    HTH.

    "Pierre via OfficeKB.com" wrote:

    > Hi,
    >
    > I have the followign code .....
    >
    > Private Sub Workbook_Open()
    > Dim Sheet As Worksheet
    > For Each Sheet In Worksheets
    > If Sheet.Name <> "waarschuwing" Then
    > Sheet.Visible = xlSheetHidden
    > End If
    > Next Sheet
    > Sheets("waarschuwing").Visible = xlSheetVeryHidden
    > Set Sheet = Nothing
    > end sub
    >
    > When the code is run, i get an error message:
    >
    > erro 1004
    > characteristic visible of class worksheet cannot be use
    >
    > any ideas?
    > Pierre
    >
    >
    > --
    > Message posted via http://www.officekb.com
    >


  2. #2
    Pierre via OfficeKB.com
    Guest

    RE: problem macro to show a warning sheet...

    thanks quartz,

    i adapted the code and that works but... now i have the following program
    piece that does not work.

    For Each Sheet In Worksheets
    If Sheet.Name <> "waarschuwing" Or Sheet.Name <> "Blad1" Then
    Sheet.Visible = xlSheetVeryHidden
    End If
    Next Sheet

    it gives an error message on the third line...
    the message was not there before but when i put the Or Sheet.Name...
    statement in, i got the error...

    any suggestions ?
    thanks,
    Pierre

    quartz wrote:
    >Your code runs fine, the problem is you must have at least one visible sheet
    >in a file. Add a blank sheet first, then hide the rest. Exclude the token
    >visible sheet from your code.
    >
    >HTH.
    >
    >> Hi,
    >>

    >[quoted text clipped - 18 lines]
    >> any ideas?
    >> Pierre



    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200511/1

  3. #3
    exceluserforeman
    Guest

    RE: problem macro to show a warning sheet...

    Hi,
    Better to use the sheets.Count and loop throught each sheet.

    for i=1 to sheets.count
    if sheets(i).name<>"blah" or sheets(i).name<> "Blergh" then
    sheets(i).visible=xlveryhidden
    end if
    next

    It also might be that you must xlhidden before you can xlveryhidden

    see my stuff at
    http://www.geocities.com/excelmarksway



    "Pierre via OfficeKB.com" wrote:

    > thanks quartz,
    >
    > i adapted the code and that works but... now i have the following program
    > piece that does not work.
    >
    > For Each Sheet In Worksheets
    > If Sheet.Name <> "waarschuwing" Or Sheet.Name <> "Blad1" Then
    > Sheet.Visible = xlSheetVeryHidden
    > End If
    > Next Sheet
    >
    > it gives an error message on the third line...
    > the message was not there before but when i put the Or Sheet.Name...
    > statement in, i got the error...
    >
    > any suggestions ?
    > thanks,
    > Pierre
    >
    > quartz wrote:
    > >Your code runs fine, the problem is you must have at least one visible sheet
    > >in a file. Add a blank sheet first, then hide the rest. Exclude the token
    > >visible sheet from your code.
    > >
    > >HTH.
    > >
    > >> Hi,
    > >>

    > >[quoted text clipped - 18 lines]
    > >> any ideas?
    > >> Pierre

    >
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200511/1
    >


  4. #4
    Rowan Drummond
    Guest

    Re: problem macro to show a warning sheet...

    Hi Pierre

    I think you need to change the "Or" statement to an "And" otherwise you
    will still be trying to hide every sheet:

    For Each Sheet In Worksheets
    If Sheet.Name <> "waarschuwing" And Sheet.Name <> "Blad1" Then
    Sheet.Visible = xlSheetVeryHidden
    End If
    Next Sheet

    Hope this helps
    Rowan

    Pierre via OfficeKB.com wrote:
    > thanks quartz,
    >
    > i adapted the code and that works but... now i have the following program
    > piece that does not work.
    >
    > For Each Sheet In Worksheets
    > If Sheet.Name <> "waarschuwing" Or Sheet.Name <> "Blad1" Then
    > Sheet.Visible = xlSheetVeryHidden
    > End If
    > Next Sheet
    >
    > it gives an error message on the third line...
    > the message was not there before but when i put the Or Sheet.Name...
    > statement in, i got the error...
    >
    > any suggestions ?
    > thanks,
    > Pierre
    >
    > quartz wrote:
    >
    >>Your code runs fine, the problem is you must have at least one visible sheet
    >>in a file. Add a blank sheet first, then hide the rest. Exclude the token
    >>visible sheet from your code.
    >>
    >>HTH.
    >>
    >>
    >>>Hi,
    >>>

    >>
    >>[quoted text clipped - 18 lines]
    >>
    >>>any ideas?
    >>>Pierre

    >
    >
    >


  5. #5
    Pierre via OfficeKB.com
    Guest

    problem macro to show a warning sheet...

    Hi,

    I have the followign code .....

    Private Sub Workbook_Open()
    Dim Sheet As Worksheet
    For Each Sheet In Worksheets
    If Sheet.Name <> "waarschuwing" Then
    Sheet.Visible = xlSheetHidden
    End If
    Next Sheet
    Sheets("waarschuwing").Visible = xlSheetVeryHidden
    Set Sheet = Nothing
    end sub

    When the code is run, i get an error message:

    erro 1004
    characteristic visible of class worksheet cannot be use

    any ideas?
    Pierre


    --
    Message posted via http://www.officekb.com

  6. #6
    quartz
    Guest

    RE: problem macro to show a warning sheet...

    Your code runs fine, the problem is you must have at least one visible sheet
    in a file. Add a blank sheet first, then hide the rest. Exclude the token
    visible sheet from your code.

    HTH.

    "Pierre via OfficeKB.com" wrote:

    > Hi,
    >
    > I have the followign code .....
    >
    > Private Sub Workbook_Open()
    > Dim Sheet As Worksheet
    > For Each Sheet In Worksheets
    > If Sheet.Name <> "waarschuwing" Then
    > Sheet.Visible = xlSheetHidden
    > End If
    > Next Sheet
    > Sheets("waarschuwing").Visible = xlSheetVeryHidden
    > Set Sheet = Nothing
    > end sub
    >
    > When the code is run, i get an error message:
    >
    > erro 1004
    > characteristic visible of class worksheet cannot be use
    >
    > any ideas?
    > Pierre
    >
    >
    > --
    > Message posted via http://www.officekb.com
    >


  7. #7
    Pierre via OfficeKB.com
    Guest

    RE: problem macro to show a warning sheet...

    thanks quartz,

    i adapted the code and that works but... now i have the following program
    piece that does not work.

    For Each Sheet In Worksheets
    If Sheet.Name <> "waarschuwing" Or Sheet.Name <> "Blad1" Then
    Sheet.Visible = xlSheetVeryHidden
    End If
    Next Sheet

    it gives an error message on the third line...
    the message was not there before but when i put the Or Sheet.Name...
    statement in, i got the error...

    any suggestions ?
    thanks,
    Pierre

    quartz wrote:
    >Your code runs fine, the problem is you must have at least one visible sheet
    >in a file. Add a blank sheet first, then hide the rest. Exclude the token
    >visible sheet from your code.
    >
    >HTH.
    >
    >> Hi,
    >>

    >[quoted text clipped - 18 lines]
    >> any ideas?
    >> Pierre



    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200511/1

  8. #8
    exceluserforeman
    Guest

    RE: problem macro to show a warning sheet...

    Hi,
    Better to use the sheets.Count and loop throught each sheet.

    for i=1 to sheets.count
    if sheets(i).name<>"blah" or sheets(i).name<> "Blergh" then
    sheets(i).visible=xlveryhidden
    end if
    next

    It also might be that you must xlhidden before you can xlveryhidden

    see my stuff at
    http://www.geocities.com/excelmarksway



    "Pierre via OfficeKB.com" wrote:

    > thanks quartz,
    >
    > i adapted the code and that works but... now i have the following program
    > piece that does not work.
    >
    > For Each Sheet In Worksheets
    > If Sheet.Name <> "waarschuwing" Or Sheet.Name <> "Blad1" Then
    > Sheet.Visible = xlSheetVeryHidden
    > End If
    > Next Sheet
    >
    > it gives an error message on the third line...
    > the message was not there before but when i put the Or Sheet.Name...
    > statement in, i got the error...
    >
    > any suggestions ?
    > thanks,
    > Pierre
    >
    > quartz wrote:
    > >Your code runs fine, the problem is you must have at least one visible sheet
    > >in a file. Add a blank sheet first, then hide the rest. Exclude the token
    > >visible sheet from your code.
    > >
    > >HTH.
    > >
    > >> Hi,
    > >>

    > >[quoted text clipped - 18 lines]
    > >> any ideas?
    > >> Pierre

    >
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200511/1
    >


  9. #9
    Rowan Drummond
    Guest

    Re: problem macro to show a warning sheet...

    Hi Pierre

    I think you need to change the "Or" statement to an "And" otherwise you
    will still be trying to hide every sheet:

    For Each Sheet In Worksheets
    If Sheet.Name <> "waarschuwing" And Sheet.Name <> "Blad1" Then
    Sheet.Visible = xlSheetVeryHidden
    End If
    Next Sheet

    Hope this helps
    Rowan

    Pierre via OfficeKB.com wrote:
    > thanks quartz,
    >
    > i adapted the code and that works but... now i have the following program
    > piece that does not work.
    >
    > For Each Sheet In Worksheets
    > If Sheet.Name <> "waarschuwing" Or Sheet.Name <> "Blad1" Then
    > Sheet.Visible = xlSheetVeryHidden
    > End If
    > Next Sheet
    >
    > it gives an error message on the third line...
    > the message was not there before but when i put the Or Sheet.Name...
    > statement in, i got the error...
    >
    > any suggestions ?
    > thanks,
    > Pierre
    >
    > quartz wrote:
    >
    >>Your code runs fine, the problem is you must have at least one visible sheet
    >>in a file. Add a blank sheet first, then hide the rest. Exclude the token
    >>visible sheet from your code.
    >>
    >>HTH.
    >>
    >>
    >>>Hi,
    >>>

    >>
    >>[quoted text clipped - 18 lines]
    >>
    >>>any ideas?
    >>>Pierre

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1