VBA paste cutting off bottom row, will not loop

afusco

New Member
Joined
Mar 16, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
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
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top