A loop to delete

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have pasted MANY lines of data from a pivot table. The original Pivot
Table had 3 lines of totals between each entry. I want the spreadsheet I am
making to have only the entry and not the three lines of totals. So I need
to delete these. Going through and manually deleting them takes a long time.
I know there is Code for a loop that will repeat a function (I can't get a
macro to). Can you help me to get the proper syntax for this. Thank you!!
 
The following code will go through the rows 10 to 1 and check the first
column's cell of each row for a value. If no value exists it will delete the
row. Obviously this isn't exactly what you wanted (I have no idea what your
data sets look like), but it should be adaptable for your uses.

For intCounterA = 10 To 1 Step -1
If Cells(intCounterA, 1).Value = "" Then
Rows(intCounterA).EntireRow.Delete
End If
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top