T
Todd Huttenstine
The following code works but I always have to run it 4
times before it deletes every value like its supposed to
do. Why does it not work 100% the first time I run it?
The code looks for blank values in a range in column D.
If it finds a blank value it selects that value through
the value in column A. It then deletes and shifts cells
up. It works but I have to run it 4 times before it finds
and deletes everything it should.
Dim RngUpld As Range
Dim CL As Object
Dim CountRecords As Long
Dim CLAddress1
Dim CLAddress2
CountRecords = Application.WorksheetFunction.Count
(Worksheets("4 Adjustment Upload File").Range("A:A")) + 1
Set RngUpld = Worksheets("4 Adjustment Upload File").Range
("D2" & CountRecords)
For Each CL In RngUpld
If CL.Value = "" Then
CLAddress1 = CL.Offset(0, -3).Address
CLAddress2 = CL.Address
Worksheets("4 Adjustment Upload File").Range
(CLAddress1 & ":" & CLAddress2).Select
Selection.Delete Shift:=xlUp
'Rows("5:5").Select
'Selection.EntireRow.Delete
Else
End If
Next
times before it deletes every value like its supposed to
do. Why does it not work 100% the first time I run it?
The code looks for blank values in a range in column D.
If it finds a blank value it selects that value through
the value in column A. It then deletes and shifts cells
up. It works but I have to run it 4 times before it finds
and deletes everything it should.
Dim RngUpld As Range
Dim CL As Object
Dim CountRecords As Long
Dim CLAddress1
Dim CLAddress2
CountRecords = Application.WorksheetFunction.Count
(Worksheets("4 Adjustment Upload File").Range("A:A")) + 1
Set RngUpld = Worksheets("4 Adjustment Upload File").Range
("D2" & CountRecords)
For Each CL In RngUpld
If CL.Value = "" Then
CLAddress1 = CL.Offset(0, -3).Address
CLAddress2 = CL.Address
Worksheets("4 Adjustment Upload File").Range
(CLAddress1 & ":" & CLAddress2).Select
Selection.Delete Shift:=xlUp
'Rows("5:5").Select
'Selection.EntireRow.Delete
Else
End If
Next