E
Ed
I have two columns of report numbers. Often, they do not match. I have a
formula in a third column that returns "ERROR" whenever it finds a number in
one column that is not found in the other. I then run the following code to
delete the excess numbers from the bottom up.
' Select the column with the ERROR message and go to the bottom
Range("AM1").Select
Selection.End(xlDown).Select
Do While ActiveCell.Value <> "Header"
' If there is no ERROR message
If ActiveCell.Value = "" Then
ActiveCell.Offset(rowOffset:=-1, columnOffset:=0).Activate
' If there is an ERROR message
' get the row number
Else: rngR = ActiveCell.Row
' go to the other column in the same row
Range("AB" & rngR).Select
' delete the cell
Selection.Delete Shift:=xlUp
' go back and continue
Range("AM" & rngR).Select
ActiveCell.Offset(rowOffset:=-1, columnOffset:=0).Activate
End If
Loop
I would like to capture the values of the cells I'm deleting and display a
message box telling me what I've deleted. How do I collect and store these
values for later display?
Ed
formula in a third column that returns "ERROR" whenever it finds a number in
one column that is not found in the other. I then run the following code to
delete the excess numbers from the bottom up.
' Select the column with the ERROR message and go to the bottom
Range("AM1").Select
Selection.End(xlDown).Select
Do While ActiveCell.Value <> "Header"
' If there is no ERROR message
If ActiveCell.Value = "" Then
ActiveCell.Offset(rowOffset:=-1, columnOffset:=0).Activate
' If there is an ERROR message
' get the row number
Else: rngR = ActiveCell.Row
' go to the other column in the same row
Range("AB" & rngR).Select
' delete the cell
Selection.Delete Shift:=xlUp
' go back and continue
Range("AM" & rngR).Select
ActiveCell.Offset(rowOffset:=-1, columnOffset:=0).Activate
End If
Loop
I would like to capture the values of the cells I'm deleting and display a
message box telling me what I've deleted. How do I collect and store these
values for later display?
Ed