Reputation: 3
I have a workbook right now that does the following processes:
Up to this point, everything is running correctly.
In [Sheet 3], each column is going to be individually treated for drop down purposes. Once the data gets to [Sheet 3], each of these columns could have several blanks that are copied over from [Sheet 2] that cause it to sort with all of those blanks ahead of the actual data making the drop down ugly.
I have created a macro to remove those blanks, but it's only doing it for the first column:
Sub Delete_Cell()
Dim lrow As Long
For lrow = Cells(Cells.Rows.Count, "A").End(xlUp).row To 2 Step -1
If Cells(lrow, "A") = "" Then Cells(lrow, "A").delete
Next lrow
End Sub
I need an adaptation to this macro that will tell it to do this for columns A through J.
Any help is appreciated.
Thanks
Upvotes: 0
Views: 34
Reputation: 96753
Consider:
Sub Delete_Cell()
Dim lrow As Long, lcol As Long
For lcol = 1 To 10
For lrow = Cells(Rows.Count, lcol).End(xlUp).Row To 2 Step -1
If Cells(lrow, lcol) = "" Then
Cells(lrow, lcol).Delete
End If
Next lrow
Next lcol
End Sub
Upvotes: 1