Link to home
Start Free TrialLog in
Avatar of Wiz_of_oz_777
Wiz_of_oz_777

asked on

Populating drop down list from another drop down list in Excel

I made this Excel batch/application that is making a dynamic form from an external Oracle database and since it takes a long time to run, I have to minimise the operations and querys made by my application. Since the form is making a lot of drop down lists that are exactly the same, I thought that copying these from one another would be faster that going through SQL to populate each and every similar drop down objects.

Public Function Copy_List(ByVal as_ObjectName, as_SourceName as String) As Integer
     CopyList = 1
     On Error GoTo MyErrHandler
     // Copy from the Source_D_D_L to the Other_D_D_L
MyErrHandler:
    MsgBox ("Error Copy_List: " & Err.Number _
            & " " & Err.Description _
            & " " & Err.Source)
    CopyList = -1
    Resume Next
End Function

Thanks 4 help !
Avatar of jgv
jgv

Assuming that you have added list items to ComboBox1 and want to copy them to ComboBox2:

ComboBox2.List = ComboBox1.List
Public Function Copy_List(as_Source As ComboBox, as_Destination As ComboBox) As Integer
    Copy_List = 1
    On Error GoTo MyErrHandler
   
    as_Destination.List = as_Source.List
    Exit Function
   
MyErrHandler:
   MsgBox ("Error Copy_List: " & Err.Number _
           & " " & Err.Description _
           & " " & Err.Source)
   Copy_List = -1
   Resume Next
End Function


MsgBox Copy_List(ComboBox1, ComboBox2)
ASKER CERTIFIED SOLUTION
Avatar of jgv
jgv

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
any response on doing this?.. I need to do something similar.

nC