anglais428
Well-known Member
- Joined
- Nov 23, 2009
- Messages
- 634
- Office Version
- 2016
- Platform
- Windows
Hi Guys,
I'm looking to see if it is possible to create a Macro that will insert 38 rows after each cell in my list of countries, then autofill down the empty rows with the country name so that each country will go from appearing once to appearing 38 times. For example:
My initial list is say (in cells A1,A2,A3):
Argentina
Australia
UK
In the end I want it to say Argentina 38 times (from cell A1:A38), then Australia 38 times (cell A39:A77) then UK 38 times( cell A78:A116)
Is this possible?
I have this Macro to insert rows but I don't know anything about coding so cannot modify it to replicate the names
Sub AddRows()
Dim lastrow As Long, cell As Range, i As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, 1)
cell.Offset(1, 0).Resize(38, 1).EntireRow.Insert
Next
End Sub
Many thanks,
I'm looking to see if it is possible to create a Macro that will insert 38 rows after each cell in my list of countries, then autofill down the empty rows with the country name so that each country will go from appearing once to appearing 38 times. For example:
My initial list is say (in cells A1,A2,A3):
Argentina
Australia
UK
In the end I want it to say Argentina 38 times (from cell A1:A38), then Australia 38 times (cell A39:A77) then UK 38 times( cell A78:A116)
Is this possible?
I have this Macro to insert rows but I don't know anything about coding so cannot modify it to replicate the names
Sub AddRows()
Dim lastrow As Long, cell As Range, i As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, 1)
cell.Offset(1, 0).Resize(38, 1).EntireRow.Insert
Next
End Sub
Many thanks,