View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Userform cannot return any values

Since the array is global in a general module, the userform can update the
array. It doesn't return it.

General Module

Dim varr() as Variant

Sub showForm()
Userform1.Show
for i = lbound(varr) to ubound(varr)
debug.print varr(i)
Next
end Sub

in the userform module

Private Sub CommandButton1_Click()
unload me
redim varr(1 to 10)
for i = 1 to 10
varr(i) = i^3
Next
End Sub

--
Regards,
Tom Ogilvy

"Nick" wrote in message
...
Hiya yet again

This time I would like a userform to be able to update a
public array defined in a normal module.

I wrote code in the class module for my form to perform
the update when it closes but it returns an error,
thinking the array is a missing sub.

I don't really want to have to write to a worksheet then
retrieve the values from there.

Is there any way I can get a userform to return a value
depending on options chosen?

Thanks in advance

Nick