vba to insert copy of row selected

M4TVD

New Member
Joined
Mar 23, 2021
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hello,
I want to be able to insert a new row below the one that I have selected, I have some code already that works for what I am trying to do, except I only want it to copy the data that is in cells A:M and not all of the information that is in that row.

this is what I have, it is set up in a module that has a button assigned to it:

Sub cOPYlINeabove()
Rows(ActiveCell.Row).Copy
Rows(ActiveCell.Row).Select
Selection.Insert Shift:=xlUp
ActiveCell.Select
Row = 1
clms = 5
ActiveCell.Offset(Row, clms).Select

End Sub

thankyou for your help!

Matt
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
How about
VBA Code:
Sub M4TVD()
   With ActiveCell
      .Offset(1).EntireRow.Insert
      Cells(.Row, 1).Resize(2, 13).FillDown
   End With
End Sub
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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