I am trying to create some VBA code,for excel, that will allow me to copy data from a number of products into a new sheet with the same name as the product. The different data for each product is separated by one column of dates which are not copied into the new sheet. I have created the following code and it works for one product, however when I add a second product the code goes wrong. Instead of copying the first column from the 2nd product it copies the third column from the previous product again then jumps straight to the second column of the second product. So the code leaves out the full first column of the second product.
Sub Forecast_Products()
Dim iterations As Integer
iterations = Cells(68, 1).Value
Dim i As Integer, j As Integer
For i = 1 To iterations
Cells(69, i).Value = 0
For j = 2 To 6 Step 2
Dim startCell As String, endCell As String
startCell = Col_Letter(j + 7 * (i - 1)) & "9"
endCell = Col_Letter(j + 7 * (i - 1)) & "60"
Range(startCell, endCell).Select
Dim salesCount As Integer
salesCount = Cells(69).Value
Cells(69).Value = salesCount + Application.WorksheetFunction.CountIf(Range(startCell, endCell), ">=0")
Selection.Copy
Dim productName As String
Sheets("Input").Activate
productName = Cells(70, i).Value
MsgBox (productName & " 70, " & CStr(i))
Sheets(productName).Activate
Dim rowStart As Variant
rowStart = CStr(11 + (52 * (j / 2 - 1)))
Range("B" & rowStart).Select
Selection.PasteSpecial xlValue
Range("M" & rowStart).Select
Selection.PasteSpecial xlValue
Sheets("Input").Activate
Next
Dim rowCount As Integer
rowCount = Cells(69, i).Value + 10
Sheets(Cells(70, i).Value).Activate
For j = 4 To 8
Dim formula As Variant
formula = Cells(17, j).Copy
startCell = Col_Letter(j) & "18"
endCell = Col_Letter(j) & CStr(rowCount)
Range(startCell, endCell).Select
Selection.PasteSpecial xlAll
Next
Next
End Sub
Function Col_Letter(lngCol As Integer) As String
Dim vArr
vArr = Split(Cells(1, lngCol).Address(True, False), "$")
Col_Letter = vArr(0)
End Function