I have data in Cols A to W from row 13 onwards (row 13 can sometimes be blank) on sheet PLAccounts
I need macro to move the data below A13 where there are blank rows and then data below the blank rows to the first row from A13 where there is no data
I tried to write code to do this, but cannot get it to works
I need macro to move the data below A13 where there are blank rows and then data below the blank rows to the first row from A13 where there is no data
I tried to write code to do this, but cannot get it to works
Code:
Sub MoveData()
Dim lastRow As Long
Dim i As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("PLAccounts")
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
If lastRow > 13 Then
For i = 23 To 1 Step -1 ' loop through columns W to A
If i <> 13 Then ' skip column M
ws.Range(ws.Cells(14, i), ws.Cells(lastRow, i)).Cut Destination:=ws.Cells(13, i)
End If
Next i
End If
End Sub