Forum Discussion
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 between columns "M" and "AF" (on the "Pending" half of the sheet)
Is this possible? Can someone help me?
Thanks so much!
- Tanya ArmitageCopper Contributor
You can highlight where you want the row to be inserted, right click and select insert then choose shift cells down.
- Lorenzo KimBronze 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 KimBronze 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")
- Lorenzo KimBronze Contributor
- Lorenzo KimBronze Contributor
- Lorenzo KimBronze Contributor