P
penguat
The help is being particularly unhelpful: I am a very inexperienced
programmer who's not worked with VB before, and I'm trying to use it to do a
stat function which I can't do any other way. essentially my code is here:
Sub StatVariance()
Worksheets("Sheet5").Cell(4, 1).Value = 3
Sum = 0
Count = 1
Dim bign As Integer
bign = Sheets("Sheet3").Cells(58, 4)
Worksheets("Sheet5").Cell(2, 2).Value = bign
Dim n As Integer
n = Sheets("Sheet1").Cells(1, 6)
Worksheets("Sheet5").Cell(1, 2).Value = n
For j = 2 To Value = Worksheets("Sheet3").Cells(61, 5)
For i = 1 To j
Worksheets("Sheet5").Cell(3, (Count + 1)).Value = Sum
Ni = 2
Nj = 2
Sum = Sum + (WorksheetFunction.Combin((bign - Ni - Nj), n) /
WorksheetFunction.Combin(bign, n))
Count = Count + 1
Next i
Next j
Worksheets("Sheet1").Cell(2, 7).Value = Sum * 2
End Sub
what's wrong with it? what I'm trying to do is a sum of sums, that bit
should be fine, it's the introductory syntax I'm struggling with: how to
define a variable and set it to 0, and I'm not sure how to even tell it that
it's a program and should run when someone changes the contents of a cell,
for example.
programmer who's not worked with VB before, and I'm trying to use it to do a
stat function which I can't do any other way. essentially my code is here:
Sub StatVariance()
Worksheets("Sheet5").Cell(4, 1).Value = 3
Sum = 0
Count = 1
Dim bign As Integer
bign = Sheets("Sheet3").Cells(58, 4)
Worksheets("Sheet5").Cell(2, 2).Value = bign
Dim n As Integer
n = Sheets("Sheet1").Cells(1, 6)
Worksheets("Sheet5").Cell(1, 2).Value = n
For j = 2 To Value = Worksheets("Sheet3").Cells(61, 5)
For i = 1 To j
Worksheets("Sheet5").Cell(3, (Count + 1)).Value = Sum
Ni = 2
Nj = 2
Sum = Sum + (WorksheetFunction.Combin((bign - Ni - Nj), n) /
WorksheetFunction.Combin(bign, n))
Count = Count + 1
Next i
Next j
Worksheets("Sheet1").Cell(2, 7).Value = Sum * 2
End Sub
what's wrong with it? what I'm trying to do is a sum of sums, that bit
should be fine, it's the introductory syntax I'm struggling with: how to
define a variable and set it to 0, and I'm not sure how to even tell it that
it's a program and should run when someone changes the contents of a cell,
for example.