View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
roman roman is offline
external usenet poster
 
Posts: 35
Default Passing argument to another Sub



"VBA Dabbler" wrote:

I'm not sure I understand all of your code, but here is my suggestion:

1. At the top of your module declare a public array without dimensioning it.
Place this string at the top : "Public StoredValueArray() as Variant"

2. In your first routine, modify it to read:

Sub CommandButton1_Click ()
Dim StoredValue(1 To 17) As Long
For i = 1 To 17
StoredValue(i) = Sheets("Schedule of Values").Cells(i+13, 3).Value
Next i
StoredValueArray = StoredValue
End Sub

3. Then use the public name in your other routines.

Good Luck,
VBA Dabbler


Tried this. Getting an error message saying that arrays cannot be declared
as public variables.