Passing a value and getting results

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?
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top