Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a public array (declared in module) from a proced
I can reference a listbox in a Worksheet using the following
Public Sub Procedure1(worksheetName As String, listBoxName As String) Dim listSize As Integer listSize = Worksheets(worksheetName).OLEObjects(listBoxName). Object.ListCount ...... end sub How do I do the same for a public array (declared in a module) with the following procedure?? Public Sub setSelections(arrayName as String) ????..... end sub Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a public array (declared in module) from a proced
Assuming arrayname is a single dimension array of type string.
Public Sub setSelections(arrayName as String) for i = lbound(arrayname) to ubound(arrayname) sStr = msg & arrayname(i) & ", " if i mod 5 = 0 then msgbox msg sStr = "" end if Next end sub -- Regards, Tom Ogilvy "Amzee" wrote in message ... I can reference a listbox in a Worksheet using the following Public Sub Procedure1(worksheetName As String, listBoxName As String) Dim listSize As Integer listSize = Worksheets(worksheetName).OLEObjects(listBoxName). Object.ListCount ..... end sub How do I do the same for a public array (declared in a module) with the following procedure?? Public Sub setSelections(arrayName as String) ????..... end sub Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a public array (declared in module) from a proced
Hi Tom,
It worked fine when I used Public Sub setSelections(arrayName() as String) Regards. "Amzee" wrote: I can reference a listbox in a Worksheet using the following Public Sub Procedure1(worksheetName As String, listBoxName As String) Dim listSize As Integer listSize = Worksheets(worksheetName).OLEObjects(listBoxName). Object.ListCount ..... end sub How do I do the same for a public array (declared in a module) with the following procedure?? Public Sub setSelections(arrayName as String) ????..... end sub Thanks! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to reference a public array (declared in module) from a proced
There were a couple of typos/mistakes. For completeness here is a cleaned
up version (although it sounds like you got what you needed). Sub Main() Dim myArr(1 To 10) As String For i = 1 To 10 myArr(i) = Chr(i + 64) & Chr(i + 65) & Chr(i + 66) Next setSelections myArr End Sub Public Sub setSelections(ArrayName() As String) For i = LBound(ArrayName) To UBound(ArrayName) sStr = sStr & ArrayName(i) & ", " If i Mod 5 = 0 Then MsgBox sStr sStr = "" End If Next End Sub -- Regards, Tom Ogilvy "Amzee" wrote in message ... Hi Tom, It worked fine when I used Public Sub setSelections(arrayName() as String) Regards. "Amzee" wrote: I can reference a listbox in a Worksheet using the following Public Sub Procedure1(worksheetName As String, listBoxName As String) Dim listSize As Integer listSize = Worksheets(worksheetName).OLEObjects(listBoxName). Object.ListCount ..... end sub How do I do the same for a public array (declared in a module) with the following procedure?? Public Sub setSelections(arrayName as String) ????..... end sub Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reference a variable declared in VBA | Excel Worksheet Functions | |||
Declaring variables in Module vs. Public | Excel Discussion (Misc queries) | |||
Passing Public Module Vairable to a Worksheet Event | Excel Programming | |||
declaring a public array | Excel Programming | |||
Public Array | Excel Programming |