Consulting

Results 1 to 3 of 3

Thread: Deleting Rows

  1. #1

    Deleting Rows

    Hello,

    I would like to draft a macro so that it deletes the second row of every sheet in the workbook based upon one condition. The condition is if the 2nd row on a given worksheet is blank then delete this row if not leave it alone and go to the next worksheet and check the 2nd row there. Naturally, the number of worksheet in the workbook is undefined.

    Thank you in advance for any help.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]
    For Each ws In Activeworkbook.Worksheets

    If Application.CountBlank(ws.Rows(2)) = ws.Columns.Count Then

    ws.Rows(2).Delete
    End If
    Next ws
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    thank you

    Nice work!


Posting Permissions

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