I am trying to reorganize sales data. I have created a macro (with recorder) to format, then copy, paste to the bottom of a new data set, then delete and do it again.
I am currently having the following issues:
- macro will not continue
- it keeps pasting over the final row of data: there are 12 rows, it pastes over the 12th row.
**i'm very new to VBA and have patch worked this code together with recorder and other threads*
' SalesCleanUp Macro
Range("M10").Select
Range("M10").Cut Destination:=Range("K3")
Range("M12").Select
Range("M12").Cut Destination:=Range("J3")
Columns("M:M").Select
Range("M2").Activate
Selection.Delete Shift:=xlToLeft
Range("J3:Q14").Select
Selection.Copy
Range("C32").Select
Selection.End(xlDown).Select
i = Worksheets("Sheet1").Cells(Rows.Count, 4).End(xlUp).Offset(2)
valuei = i + 1
Sheets("sheet1").Select
ActiveCell.Value = valuei
ActiveCell.Offset(0, -2).Select
ActiveSheet.Paste
Range("H224").Select
Selection.End(xlUp).Select
Columns("M:R").Select
Range("M2").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
ActiveWindow.SmallScroll Down:=-15
End Sub
I am currently having the following issues:
- macro will not continue
- it keeps pasting over the final row of data: there are 12 rows, it pastes over the 12th row.
**i'm very new to VBA and have patch worked this code together with recorder and other threads*
' SalesCleanUp Macro
Range("M10").Select
Range("M10").Cut Destination:=Range("K3")
Range("M12").Select
Range("M12").Cut Destination:=Range("J3")
Columns("M:M").Select
Range("M2").Activate
Selection.Delete Shift:=xlToLeft
Range("J3:Q14").Select
Selection.Copy
Range("C32").Select
Selection.End(xlDown).Select
i = Worksheets("Sheet1").Cells(Rows.Count, 4).End(xlUp).Offset(2)
valuei = i + 1
Sheets("sheet1").Select
ActiveCell.Value = valuei
ActiveCell.Offset(0, -2).Select
ActiveSheet.Paste
Range("H224").Select
Selection.End(xlUp).Select
Columns("M:R").Select
Range("M2").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
ActiveWindow.SmallScroll Down:=-15
End Sub