Hello,
I have a list of product codes
coulmn a has the product code
column b has quantity
column c & d contain a basic formula
I need to insert a string of numbers into every fourth row
so after 3 product codes, insert blank line and enter "12345678" into column a and enter "1" into column b
the catch is, that I need to leave the first 12 product codes alone, so i would need after 12 products to insert the first row with "12345678" into column a and enter "1" into column b, and then after every 3 product to insert the line again.
I came across the following code, however i cannot get it to start after the 12th product only
Dim Last As Integer
Dim emptyRow As Integer
Last = Range("A" & Rows.Count).End(xlUp).Row
For emptyRow = Last To 14 Step -3
If Not Cells(emptyRow, 1).Value = "" Then
Rows(emptyRow).Resize(1).Insert
Range(Cells(emptyRow, "A"), Cells(emptyRow, "C")).Value = Array("12345678", "1", "")
End If
Next emptyRow
End Sub
i guess i can change "last to" if we can get the loop to start after the 12th product
so in short if i have 1000 numbers in column a
i need it to go to line 13 and insert a row and enter "12345678"
then do the same in row17 then row 21 etc
thanks in advance
I have a list of product codes
coulmn a has the product code
column b has quantity
column c & d contain a basic formula
I need to insert a string of numbers into every fourth row
so after 3 product codes, insert blank line and enter "12345678" into column a and enter "1" into column b
the catch is, that I need to leave the first 12 product codes alone, so i would need after 12 products to insert the first row with "12345678" into column a and enter "1" into column b, and then after every 3 product to insert the line again.
I came across the following code, however i cannot get it to start after the 12th product only
Dim Last As Integer
Dim emptyRow As Integer
Last = Range("A" & Rows.Count).End(xlUp).Row
For emptyRow = Last To 14 Step -3
If Not Cells(emptyRow, 1).Value = "" Then
Rows(emptyRow).Resize(1).Insert
Range(Cells(emptyRow, "A"), Cells(emptyRow, "C")).Value = Array("12345678", "1", "")
End If
Next emptyRow
End Sub
i guess i can change "last to" if we can get the loop to start after the 12th product
so in short if i have 1000 numbers in column a
i need it to go to line 13 and insert a row and enter "12345678"
then do the same in row17 then row 21 etc
thanks in advance