Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Starting a procedure at sheet 3

  1. #1
    Guest

    Default

    How can I edit this code to ignore sheets 1 and 2 and always start at worksheet 3 ?

    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
    If IsEmpty(ws.Range("B2")) Then _
    ws.Range("B4:B36,G6:G29").ClearContents
    Next ws

    Eugene Robinson
    Rhos on Sea

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I am ssume you mean the sheets Index number when you say sheets 1 and 2, so this code should do it:

    Dim i As Integer
    For i = 3 To Sheets.Count
    If IsEmpty(Sheets(i).Range("B2")) Then _
    Sheets(i).Range("B4:B36,G6:G29").ClearContents
    Next i


  3. #3
    Guest

    Default

    Thanks for that Dave. Does the job

    Cheers
    Eugene

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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