W
WOMBAT
I want to pass an array to a subroutine: I tried some
variants such as Call Output(K(*)) (used in some forms of
HP BASIC), but could not find one that worked. Any ideas
anyone?
For t = 1 To NT 'put data in array
For w = 1 To NW
K(t, w) = t * w
Next w
Next t
Call Output_data(Sheet1, K()) 'pass sheet & array to sub
'this syntax is not accepted by VBA
'
End Sub
'
Sub Output_data(Sheet_name, K_temp())
'this should allow various versions of K to be output to
various sheets
For t = 1 To NT
For w = 1 To NW
Sheet_name.Cells(1 + w, 1 + t) = K_temp(t, w)
Next w
Next t
End Sub
variants such as Call Output(K(*)) (used in some forms of
HP BASIC), but could not find one that worked. Any ideas
anyone?
For t = 1 To NT 'put data in array
For w = 1 To NW
K(t, w) = t * w
Next w
Next t
Call Output_data(Sheet1, K()) 'pass sheet & array to sub
'this syntax is not accepted by VBA
'
End Sub
'
Sub Output_data(Sheet_name, K_temp())
'this should allow various versions of K to be output to
various sheets
For t = 1 To NT
For w = 1 To NW
Sheet_name.Cells(1 + w, 1 + t) = K_temp(t, w)
Next w
Next t
End Sub