ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A loop to delete (https://www.excelbanter.com/excel-programming/318269-loop-delete.html)

Nikki

A loop to delete
 
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!!
--
Thanks,
Nikki

Meek Spiffinton[_2_]

A loop to delete
 
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

"Nikki" wrote:

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!!
--
Thanks,
Nikki



All times are GMT +1. The time now is 01:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com