Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Feb 2011
    Posts
    27
    Thanks
    4
    Thanked 0 Times in 0 Posts

    deleting rows using excel macro

    Hi
    I have a set of data, where I want to scroll through the rows, and delete the ones that have the word "BlanK" in column C. I would also like to stop when a cell in column C is empty.The data are imported from a .csv file and are in General format. A newbie, I am still not fully versed in the VBA syntax and I have tried a couple of things but can't seem to get it to work correctly. It seems to me that this should be rather simple but I have already blown a couple of hours on this. Any suggestions would be appreciated.

    I tried this but it doesn't seem to recognize "Blank" or Blank. There also may be an issue when a row is deleted (the old active cell is now the new active cell without being offset. I am using Excel 2007.

    Sub DeleteRows()

    Range("c5").Activate

    Do While ActiveCell.Value <> Empty
    If ActiveCell.Value = "Blank" Then
    Rows(ActiveCell.Row).Delete
    Else
    ActiveCell = ActiveCell.Offset(1, 0).Select
    End If

    ActiveCell = ActiveCell.Offset(1, 0).Select
    Loop



    End Sub

  2. #2
    3 Star Lounger Jim Cone's Avatar
    Join Date
    Feb 2002
    Location
    Portland, Oregon, USA
    Posts
    238
    Thanks
    0
    Thanked 3 Times in 3 Posts
    See your other identical post in Spreadsheets.

Posting Permissions

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