Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieve an array from a function?
Help please!
I am using VBA in Excel XP with Windows 2000. I am fairly experienced using VBA, but I recently began using functions. Is it possible to return an array from a function? For example, the following function call retrieves a month and a year from drop downs in a toolbar. The actual function gets the information, but how do I retrieve this info from the function to my subroutine in a separate module? Call Obtain_Period("Bank_Month", "Bank_Year") Thanks inadvance for the lesson. Your example code would be most appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieve an array from a function?
You don't need a function
Sub DoingTheCalling() dim lngMonth as Long Dim lngYear as Long Call Obtain_Period(lngMonth, lngYear) msgbox "Month: " & lngMonth & " Year: " & lngYear End Sub Sub Obtain_Period(lMonth as Long, lYear as Long) Dim ctlMonthComboBox As CommandBarComboBox Dim ctlYearComboBox As CommandBarComboBox Dim cBar as Commandbar set cBar = CommandBars("Custom1") set ctlMonthCombobox = cbar.Controls("MonthDropDown") set ctlYearCombobox = cbar.Controls("YearDropDown") lMonth = clng(ctlMonthCombobox.Text) lYear = clng(ctlYearCombobox.Text) End Sub If your Month combobox is producing strings, then change the code to address a string. -- Regards, Tom Ogilvy "PK" wrote in message ... Help please! I am using VBA in Excel XP with Windows 2000. I am fairly experienced using VBA, but I recently began using functions. Is it possible to return an array from a function? For example, the following function call retrieves a month and a year from drop downs in a toolbar. The actual function gets the information, but how do I retrieve this info from the function to my subroutine in a separate module? Call Obtain_Period("Bank_Month", "Bank_Year") Thanks inadvance for the lesson. Your example code would be most appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
function to retrieve array name | Excel Worksheet Functions | |||
Is it possible to use the lookup function to retrieve objects? | Excel Discussion (Misc queries) | |||
Is there a function/formula to retrieve the weeknumber? | Excel Worksheet Functions | |||
function to retrieve a list of unique characters from a column | Excel Worksheet Functions | |||
Can I retrieve a value and its format using the minimum function? | Excel Worksheet Functions |