EXCEL MACRO TO REPEAT AND INSERT ROWS
Solved/Closed
KU
-
May 6, 2010 at 05:16 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 6, 2010 at 06:01 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 6, 2010 at 06:01 PM
Related:
- EXCEL MACRO TO REPEAT AND INSERT ROWS
- Insert gif in excel - Guide
- Spell number in excel without macro - Guide
- How to insert photo in word for resume - Guide
- How to insert check mark in word - Guide
- How to insert watermark in word - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 6, 2010 at 06:01 PM
May 6, 2010 at 06:01 PM
This is based on assumption that
1. Data to be copied start from row 2
2. The series is in column A
3. Row 1 has the max used column
1. Data to be copied start from row 2
2. The series is in column A
3. Row 1 has the max used column
Sub RepeatAndRinse() Dim lMaxRows As Long Dim iMaxCols As Long Dim iStartAtRow As Integer lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row iMaxCols = Cells(1, Columns.Count).End(xlToLeft).Column iStartAtRow = 2 Range(Cells(iStartAtRow, 2), Cells(lMaxRows, iMaxCols)).Copy Cells(lMaxRows + 1, 2).Select ActiveSheet.Paste Cells(lMaxRows, 1).Select Selection.AutoFill Destination:=Range("A" & lMaxRows & ":A" & lMaxRows * 2 + (1 - iStartAtRow)), Type:=xlFillSeries End Sub