TRHorn,
First, you have an underscore before your 9. Unless you were dropping down to a new line and just forgot to take it out before you posted online, that is going to cause an issue.
The way you have your code set up now, every single cell in the range will have the exact same number. For example, if we modify your code for simplicity (and because I don't know what your other variables are),
Code:
For H = 1 To 12
ActiveSheet.Range(Cells(H, 1), Cells(H, 9)).Value = H
Next H
running this code will produce
1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3
etc..
Another point of interest I see is when you declare your For loop. If sngTot is a single data type, which the prefix implies, the loop will only accept the integer portion of it. For example, if sngTot =7.56, the loop will ignore the decimal and accept the 7 as a parameter.
If you are trying to extract data out of an array to correspond with each cell, try something like this:
Code:
For H = 1 To sngTot
ActiveSheet.Cells(Row, H) = myArray(H)
Next H
Or, if you are trying to match up with 2D arrays, use you can use nested loops.
Code:
For H = 1 To sngTot
For I = 1 To 9
ActiveSheet.Cells(H, I) = myArray(H, I)
Next I
Next H
The outside loop will iterate through each row, while the inside loop will iterate through each column.
The other way to pull array data into cells without loops is by calling a function and sending an array of cells. This is done by selecting a group of cells, entering a formula, and then pressing SHIFT + ENTER (or maybe there is a CTRL button in there too, I forget). The function will execute and fill the array data into the cells.
-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]