First time posting so I will apologize up front for not following conventions or doing something incorrectly.
The below code is to look at a table exported from another program and load the information that it needs into an array for reformatting/use later.
Sub Hours()
'
' Project Hours Report from PMIS
'
Dim a, b, c, x, y, z, TotalRows
Dim ReportInfo() As Variant
x = 6
TotalRows = 0
Do While Cells(x, 2) <> ""
TotalRows = TotalRows + 1
x = x + 1
Loop
TotalRows = TotalRows - 1
ReDim ReportInfo(TotalRows, 3)
y = 1
For x = 6 To TotalRows + 6
ReportInfo(y, 1) = Cells(x, 10) ' Activity
ReportInfo(y, 2) = Cells(x, 2) ' Name
ReportInfo(y, 3) = Cells(x, 6) ' Hours
y = y + 1
Next x
'
End Sub
Display More
But when I try to execute I get the subscript out of range error the first time I try to load in a value (ReportInfo(y, 1) = Cells(x, 10) ' Activity). I don't understand why as I've done this in other macros and it has worked. Am I just missing something?
I'd like to understand why it is happening so I don't need to ask again, as well as help with the code. But please keep something in mind - I'm not a programmer (as I am entirely self taught); I've seen some pretty cool programming that does things more efficiently than I ever could, but I don't have the experience/knowledge base to follow. And I'm getting old. So if you could tell me what is wrong with MY code I would appreciate it.