Passing a value and getting results

  • Thread starter Thread starter George
  • Start date Start date
G

George

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?
 
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
 
Back
Top