I see 3 reasons to bugs:
1)
Dim sheet As Excel.Worksheet
Never use variable named "sheet", becouse it is Excel name.
Excel have Worksheets and Sheets collections. Read more about differences on msdn website.
Dim oSheet As Excel.Worksheet
2)
oSheet.Cells(Row,Column)
I have'nt see declarations for: "Row" and "Column"
You should always use
Option Explicit
keyword to enforce declaration of variables.
3)
For i=1 To values.Length
oSheet.Cells(i, 1) = values(i)
Next i
When you use arrays in For ... To ... loop, the default lower bound is 0 (zero), not 1. Use
Option Base 1
keyword to enumerate arrays from 1.
And one advise:
Use
Range("A" & i)
object. This is better and quickest then:
sSheet.Cells(1,i)
.
oRng = oSheet.Range("A" & i) 'direct access
oRng.Value = "Example 1"
To change column in iteration you can use
Offset
object. For example (using sheet object):
With oSheet
.Range("A1").Offset(RowOffset:=0,ColumnOffset:=i)
End With