Results 1 to 5 of 5
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Looping sheets in workbook... (2000)

    You haven't set WBK to anything.

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17> Please try to pay some attention to your spelling - surely you can do better than "Lopping shhest"

  2. #2
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Looping sheets in wbook... (2000)

    why have error....in WBK.Worksheets

    Dim WS As Worksheet
    Dim WBK As Workbook

    For Each WS In WBK.Worksheets
    If Left(WS.Name, 5) = "T0018" Then
    '...
    Exit For
    End If
    Next WS

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Looping sheets in workbook... (2000)

    Modified title of post..:-)

    Set WB = ThisWorkbook
    or
    set = complete name of wbook

    ???

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Looping sheets in workbook... (2000)

    The name of the variable in your first post is WBK, not WB.

    You can use

    Set WBK = ActiveWorkbook

    if you want to set it to the currently active workbook, or

    Set WBK = ThisWorkbook

    if you want to set it to the workbook containing the code. This will usually be the same as the active workbook.

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Looping sheets in workbook... (2000)

    Ok, good note!
    Tks.

Posting Permissions

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