I need a VBA code to delete empty cells under the filled cells since line 1, as usual.
I need this to a range of A:IV.
I have this:
1 1 1 1 1
2 2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
6 6 6
7 7 7
8 8
9
10
And I need this:
1
2
3 1
4 1 2
5 2 3
6 1 3 4
7 2 4 5
8 3 5 6
9 4 6 1 7
10 5 7 2 8
Actually there are dozens of columns and hundreds of lines, and I will do this not just one time.
I did a search for some code and tried to recording and change some actions, like:
Sub deljustthiscells()
Selection.Delete Shift:=xlDown
End Sub
Didn't work.
Or this, to make all the job from one time, which is what I really need:
Sub delcells()
Dim l As Long
l = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
For l = l To 500 Step 1
If Sheets("Sheet1").Cells(l, 1) = "" Then
Cells(l, 1).Cell.Delete
End If
Next l
End Sub
Didn't work, too.
Guess it's something pretty simple from here.
This code should avoid hours of work.
If somebody can help me, please!
Bookmarks