View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Passing a value and getting results

Private Sub Combobox1_Click()
with combobox1.listIndex
case 0
returnNumbers = Array(1,2,3)
case 1
returnNumbers = array(4,5,6)
case else
returnNumbers = array(7,8,9)
End Case
End Sub

In a general module

Public returnNumbers as Variant

Public Sub MyFunc()
Application.Volatile
MyFunc = returnNumbers
End Function

Select A1 to C1
in the formulabar enter
=MyFunc()

end with Ctrl+Shift+Enter




--
Regards,
Tom Ogilvy



"George" wrote in message
...
I need to pass a value from a list box to a worksheet and
get a number of values back to display to a user. I'm
using a listbox for the user to choose the original value.
Does anyone have VB code to help me get started?