
04-30-2008, 01:38 AM
|
|
Newcomer
|
|
Join Date: Apr 2008
Location: Lund, Sweden
Posts: 1
|
|
vector->worksheet
|
Hello,
I create a vector in a macro and want to send it to the worksheet. How do I do?
Sub simulete()
'simulates randomnumbers around a line y(i)=beta_0+beta_1*x(i)
Dim beta0, beta1 As Double
Dim n As Integer
Dim x(1 To 100) As Double
Dim y(1 To 100) As Double
Dim uniform As Double
Dim vRand
beta0 = Range("A2") 'intercept
beta0 = Range("B2") 'slope
n = 100
For i = 1 To n
x(i) = i
vRand = Rnd()
NormRnd = WorksheetFunction.NormSInv(vRand)
y(i) = beta0 + x(i) * beta1 + NormRnd
Next i
'Range("A3", "A103") = x(1 To 100) I wanna do something like this
'Range("B3", "B103") = y, or like this but I don't get it to work
End Sub
/Tobias
|
|