macro insert row

lealeadupont

New Member
Joined
Feb 1, 2022
Messages
16
Office Version
  1. 365
Platform
  1. MacOS
Good morning,
I need to write a macro to insert a new row between every second row ( the 10 rows of the employee). And empty row between employee 1 to employee 2 etc.
And I'm on a Mac ! :)

thank youuu
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Assuming you have data in column 1
And assuming a MAC will run my code that works on a PC

Try this:
VBA Code:
Sub Insert_Rows()
'Modified 2/1/2022  5:23:55 PM  EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For i = Lastrow To 1 Step -1
Rows(i).Insert
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
But when I'm trying to run this macro I have :
Invalid procedure call or argument
 
Upvote 0
Assuming you have data in column 1
And assuming a MAC will run my code that works on a PC

Try this:
VBA Code:
Sub Insert_Rows()
'Modified 2/1/2022  5:23:55 PM  EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For i = Lastrow To 1 Step -1
Rows(i).Insert
Next
Application.ScreenUpdating = True
End Sub
But when I'm trying to run this macro I have :
Invalid procedure call or argument
 
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