• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Deleting rows

aleksandra123

New Member
Hi Guys,
I stuck at one point. I have a sheet where I need to delete some rows. Please find enclosed the sample file. I've marked in yellow the lines to be deleted. What is important the "data"lines are changing sometimes is 5 sometimes is 10 thats way I am thinking to have DO until loop which will be searching first blank line then delete this line along with next 5 lines and then come back and search the new blank line and delete and so on. But I dont know how to finish the loop. Any ideas?
 

Attachments

  • sampleDATA.xlsx
    8.3 KB · Views: 6
aleksandra123
Which rows would You like to delete?
You wrote 'some rows' ... okay? ... this deletes all yellow!
or
rows which do not have text 'data' in the beginning?
or
total blank rows?
or
which?
 
I wanna delete this marked in yello so blank then data to be deleted and then blank . then there is data (it always should stay) and then combination of blank data to be deleted and blank repeats and I wanna erase it. I marked it in yello just to visualize which rows are not needed. Normally there is no colour there so I cannot based macro on the colour of rows.
 
How about
Code:
Sub aleksandra123()
  Dim i As Long
 
  With Range("A:A").SpecialCells(xlBlanks)
      For i = .Areas.Count To 1 Step -2
        Rows(.Areas(i).Row & ":" & .Areas(i - 1).Row).Delete
      Next i
  End With
End Sub
 
aleksandra123
I asked four questions... hmm?
Which one? I didn't get an answer.
Now, You wrote something and
some rows should erase - some delete ...
I marked it in yello just to visualize which rows are not needed.
YES ... hmm? but my sample would do that!
but ...
If #6 reply don't work ...
then please mark with red color those rows which should stay!
after that, I'll try to figure Your logic...
 
Back
Top