Forum Discussion
Beers Team
Jul 24, 2018Copper Contributor
Need Macro that inserts Partial Row into excel (Not an entire Row)
Hi all, I have a version of our team's spreadsheet attached here. I've learned how to use a macro to add a new row, but the problem is, it adds an ENTIRE row and i only want to insert a row b...
Lorenzo Kim
Jul 25, 2018Bronze Contributor
if there are data after the designated row to insert - you might have to copy down one cell those data.
example: row to insert = row (M)40
LastRow = Cells(Rows.Count, "M").End(xlUp).Row
range("M40:AF" & Lastrow).copy
range("M41").select
ActiveSheet.paste
range("M40:AF40").ClearContents
I didn't use CUT - as sometime queer things happens
try this out in a different workbook - just in case.
HTH
- Lorenzo KimJul 25, 2018Bronze Contributora shorter version:
LastRow = Cells(Rows.Count, "M").End(xlUp).Row
Range("M40:AF" & Lastrow).copy Range("M41")
Range("M40:AF40").ClearContents
or you may try:
LastRow = Cells(Rows.Count, "M").End(xlUp).Row
Range("M40:AF" & Lastrow).Cut Range("M41")