Macro for inserting multiple rows between data
Closed
vba dummy
-
Jul 7, 2016 at 03:56 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Contributor Last seen December 27, 2022 - Jul 11, 2016 at 12:13 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Contributor Last seen December 27, 2022 - Jul 11, 2016 at 12:13 PM
Related:
- Vba insert multiple rows
- Excel vba insert multiple rows - Best answers
- How to insert multiple rows in excel between data - Best answers
- Vba matrix multiplication - Excel Forum
- Vba case like - Guide
- How to insert rows in excel automatically based on cell value without vba ✓ - Excel Forum
- Insert key - Guide
- How to insert multiple rows in microsoft excel - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Contributor
Last seen
December 27, 2022
555
Jul 11, 2016 at 12:13 PM
Jul 11, 2016 at 12:13 PM
Hi vba dummy,
Assuming that there are no empty rows between the data you have and a row of data always has something in column A, try this code:
How to implement and run a code:
- From Excel hit Alt + F11 to open the “Microsoft Visual Basic” window.
- Go to the top menu in the newly opened window > Insert > Module.
- Paste the code in the big white field.
- You can now close this window.
- Back at Excel, hit Alt + F8 to display the available macro’s.
- Double-click the macro you wish to run.
NOTE: macro’s cannot be reversed using the blue arrows. Always make sure you save your file before running a code, so you can re-open your file if something unforeseen happens or you want to go back to the situation before the code was run.
Best regards,
Trowa
Assuming that there are no empty rows between the data you have and a row of data always has something in column A, try this code:
Sub RunMe() Dim x As Integer x = 2 Do Rows(x).Resize(45).Insert x = x + 46 Loop Until IsEmpty(Cells(x, "A")) End Sub
How to implement and run a code:
- From Excel hit Alt + F11 to open the “Microsoft Visual Basic” window.
- Go to the top menu in the newly opened window > Insert > Module.
- Paste the code in the big white field.
- You can now close this window.
- Back at Excel, hit Alt + F8 to display the available macro’s.
- Double-click the macro you wish to run.
NOTE: macro’s cannot be reversed using the blue arrows. Always make sure you save your file before running a code, so you can re-open your file if something unforeseen happens or you want to go back to the situation before the code was run.
Best regards,
Trowa