K
KC Rippstein
Hello. I would really appreciate some help with writing a macro, please.
I have a report that imports data from another system as a list. It
contains upwards of 20,000 rows and can be considerably consolidated, but it
has issues. I filter for zero dollar values on the money amount column, hit
F5-Special-Visible and try to delete the rows but it doesn't work (it either
tells me the task is too complex or it deletes all but one record).
So I pulled a simple macro off the forum here that looks for zero values in
the column I want on a row by row basis.
Sub Delete_ZeroValue_Rows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
ActiveSheet.DisplayPageBreaks = False
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "F").End(xlUp).Row
For r = lastrow To 1 Step -1
If Cells(r, "F").Value = 0 Then
Rows(r).EntireRow.Delete
End If
Next r
ActiveSheet.DisplayPageBreaks = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
This works well and gets my list cut in half within 30 seconds. Here's what
else I need, though:
1) I'd like to change it from being fixed to column F to instead ask me for
the money column.
2) I'd like it to show me an application status bar and then tell me how
many rows were deleted (Chip Pearson has something like this, but I'm not
sure how to plug it into this code correctly...it gave me error 400 when I
attempted it myself).
3) I then need to filter the same money column for positive and negative
values that cancel each other out within the same month. I suppose it
should ask me what column contains the dates, sort the data by month, then
look for positive/negative cancellation entries within that month's block of
data (the canceling entries may not necessarily be in order one right after
the other but may be separated by a couple of entries).
Thanks a bunch!!
KC Rippstein
I have a report that imports data from another system as a list. It
contains upwards of 20,000 rows and can be considerably consolidated, but it
has issues. I filter for zero dollar values on the money amount column, hit
F5-Special-Visible and try to delete the rows but it doesn't work (it either
tells me the task is too complex or it deletes all but one record).
So I pulled a simple macro off the forum here that looks for zero values in
the column I want on a row by row basis.
Sub Delete_ZeroValue_Rows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
ActiveSheet.DisplayPageBreaks = False
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "F").End(xlUp).Row
For r = lastrow To 1 Step -1
If Cells(r, "F").Value = 0 Then
Rows(r).EntireRow.Delete
End If
Next r
ActiveSheet.DisplayPageBreaks = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
This works well and gets my list cut in half within 30 seconds. Here's what
else I need, though:
1) I'd like to change it from being fixed to column F to instead ask me for
the money column.
2) I'd like it to show me an application status bar and then tell me how
many rows were deleted (Chip Pearson has something like this, but I'm not
sure how to plug it into this code correctly...it gave me error 400 when I
attempted it myself).
3) I then need to filter the same money column for positive and negative
values that cancel each other out within the same month. I suppose it
should ask me what column contains the dates, sort the data by month, then
look for positive/negative cancellation entries within that month's block of
data (the canceling entries may not necessarily be in order one right after
the other but may be separated by a couple of entries).
Thanks a bunch!!
KC Rippstein