I have a list of about 40 rows, and each row has an ID, year, and total value. I need to create a row with the ID and Year and a number starting at one up and going the total value.
For example, if row one of my data was
12 2011 3
I would need to create
12 2011 1
12 2011 2
12 2011 3
This is what I have, but when I run it nothing happens.
Sub barCodeSheet()
Dim maxVal As Long, id As Long, year As Long
For Counter = 1 To maxVal
Location.Value = Counter
Location.Offset(0, -1).Value = year
Location.Offset(0, -2).Value = id
Set Location = Location.Offset(1, 0)
Next Counter
End Sub
Sub retrieve()
Dim maxVal As Long, id As Long, year As Long, Row_Count As Long
Row_Count = Application.CountA(Range("A:A"))
Set Location = Cells(6, 2)
For Counter = 2 To Row_Count
id = Cells(Counter, 1).Value
maxVal = Cells(Counter, 4).Value
year = Cells(Counter, 3).Value
Call barCodeSheet
Next Counter
End Sub
For example, if row one of my data was
12 2011 3
I would need to create
12 2011 1
12 2011 2
12 2011 3
This is what I have, but when I run it nothing happens.
Sub barCodeSheet()
Dim maxVal As Long, id As Long, year As Long
For Counter = 1 To maxVal
Location.Value = Counter
Location.Offset(0, -1).Value = year
Location.Offset(0, -2).Value = id
Set Location = Location.Offset(1, 0)
Next Counter
End Sub
Sub retrieve()
Dim maxVal As Long, id As Long, year As Long, Row_Count As Long
Row_Count = Application.CountA(Range("A:A"))
Set Location = Cells(6, 2)
For Counter = 2 To Row_Count
id = Cells(Counter, 1).Value
maxVal = Cells(Counter, 4).Value
year = Cells(Counter, 3).Value
Call barCodeSheet
Next Counter
End Sub