Consulting

Results 1 to 3 of 3

Thread: Solved: Deleting Rows

  1. #1
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location

    Solved: Deleting Rows

    2 questions:

    1) How to delete all Used rows except Row 1.
    2) For Columns A to V, delete all used rows except row 1
    For Columns W to Z delete all used rows except rows 1 & 2

    Please advise

    thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Untested

    1)

    [vba]
    With ActiveSheet

    .UsedRange.Rows(2).Resize(.UsedRange.Rows.Count -1).Delete
    End With
    [/vba]

    2)

    [vba]
    With ActiveSheet

    .UsedRange.Cells(2, 1).Resize(.UsedRange.Rows.Count -1, 22).ClearContents
    End With
    [/vba]

    erc.
    ____________________________________________
    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
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location
    Yup, you're right as usual!
    Thanks a lot Xld!

Posting Permissions

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