I currently use the code below. I now have data in column H, so I have changed the range part to Range("A2:H3001"), as I want to iterate numbers in column H, too. However, this column contains different formulae in the rows, and I only want the script to iterate the number every 3rd row in each set of 8 rows. I think I would use "If i = 3 Then", but I'm not sure how I would apply this to only column H, as I still want the script to run as below with columns A to G.
Could anyone suggest how I would acheive this, please?
Thanks
VBA Code:
Sub IncrementRowNumbers()
Dim i As Integer, j As Integer
Dim replaceNum As Integer
Dim myArray As Variant
Dim myRange As Range
Set myRange = Worksheets("All Data").Range("A2:G3001")
myArray = myRange.Formula
replaceNum = 6
For i = 1 To UBound(myArray, 1)
For j = 1 To UBound(myArray, 2)
If j <> 4 And j <> 5 Then
myArray(i, j) = Replace(myArray(i, j), "6", replaceNum + Int((i - 1) / 6))
End If
Next
Next
myRange.Formula = myArray
End Sub
Could anyone suggest how I would acheive this, please?
Thanks