Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform to display dropdown list of open XL files
I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files to compare. I've tried reverse engineering Chip Pearson's code in his "Compare" macro, but it's just beyond my current skill level. And I looked for information in this NG, but couldn't find a solution, probably I just don't know how to phrase the search criteria correctly. I have almost no experience with forms in XL, other than creating a simple form to ask the user for input and put the data in a cell. But I do know how to create a basic form. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform to display dropdown list of open XL files
Create a userform and add two combo boxs to it. Add this code to the form and
you will get your two combo boxes... Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name Next wbk End Sub -- HTH... Jim Thomlinson "davegb" wrote: I want to create a userform to display 2 dropdown lists, both with all currently opened XL files in the list, so the user can select 2 files to compare. I've tried reverse engineering Chip Pearson's code in his "Compare" macro, but it's just beyond my current skill level. And I looked for information in this NG, but couldn't find a solution, probably I just don't know how to phrase the search criteria correctly. I have almost no experience with forms in XL, other than creating a simple form to ask the user for input and put the data in a cell. But I do know how to create a basic form. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform to display dropdown list of open XL files
You might want to add:
Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks if wbk.windows(1).Visible = True then ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name end if Next wbk End Sub This will avoid including workbooks that are hidden. -- Regards, Tom Ogilvy "Jim Thomlinson" wrote in message ... Create a userform and add two combo boxs to it. Add this code to the form and you will get your two combo boxes... Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name Next wbk End Sub -- HTH... Jim Thomlinson "davegb" wrote: I want to create a userform to display 2 dropdown lists, both with all currently opened XL files in the list, so the user can select 2 files to compare. I've tried reverse engineering Chip Pearson's code in his "Compare" macro, but it's just beyond my current skill level. And I looked for information in this NG, but couldn't find a solution, probably I just don't know how to phrase the search criteria correctly. I have almost no experience with forms in XL, other than creating a simple form to ask the user for input and put the data in a cell. But I do know how to create a basic form. Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform to display dropdown list of open XL files
Tom Ogilvy wrote: You might want to add: Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks if wbk.windows(1).Visible = True then ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name end if Next wbk End Sub This will avoid including workbooks that are hidden. -- Regards, Tom Ogilvy Thanks, both of you. I probably should have asked earlier, but how do I capture the spreadsheet names once they've been selected and the OK button clicked? "Jim Thomlinson" wrote in message ... Create a userform and add two combo boxs to it. Add this code to the form and you will get your two combo boxes... Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name Next wbk End Sub -- HTH... Jim Thomlinson "davegb" wrote: I want to create a userform to display 2 dropdown lists, both with all currently opened XL files in the list, so the user can select 2 files to compare. I've tried reverse engineering Chip Pearson's code in his "Compare" macro, but it's just beyond my current skill level. And I looked for information in this NG, but couldn't find a solution, probably I just don't know how to phrase the search criteria correctly. I have almost no experience with forms in XL, other than creating a simple form to ask the user for input and put the data in a cell. But I do know how to create a basic form. Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform to display dropdown list of open XL files
My preference is to not unload the form, but just to hide it. Then you can
just referdirectly to the combo boxes somethin like this... workbooks(combobox1.text).select -- HTH... Jim Thomlinson "davegb" wrote: Tom Ogilvy wrote: You might want to add: Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks if wbk.windows(1).Visible = True then ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name end if Next wbk End Sub This will avoid including workbooks that are hidden. -- Regards, Tom Ogilvy Thanks, both of you. I probably should have asked earlier, but how do I capture the spreadsheet names once they've been selected and the OK button clicked? "Jim Thomlinson" wrote in message ... Create a userform and add two combo boxs to it. Add this code to the form and you will get your two combo boxes... Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name Next wbk End Sub -- HTH... Jim Thomlinson "davegb" wrote: I want to create a userform to display 2 dropdown lists, both with all currently opened XL files in the list, so the user can select 2 files to compare. I've tried reverse engineering Chip Pearson's code in his "Compare" macro, but it's just beyond my current skill level. And I looked for information in this NG, but couldn't find a solution, probably I just don't know how to phrase the search criteria correctly. I have almost no experience with forms in XL, other than creating a simple form to ask the user for input and put the data in a cell. But I do know how to create a basic form. Thanks. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform to display dropdown list of open XL files
Jim Thomlinson wrote: My preference is to not unload the form, but just to hide it. Then you can just referdirectly to the combo boxes somethin like this... workbooks(combobox1.text).select -- HTH... Jim Thomlinson Thanks to you both! "davegb" wrote: Tom Ogilvy wrote: You might want to add: Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks if wbk.windows(1).Visible = True then ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name end if Next wbk End Sub This will avoid including workbooks that are hidden. -- Regards, Tom Ogilvy Thanks, both of you. I probably should have asked earlier, but how do I capture the spreadsheet names once they've been selected and the OK button clicked? "Jim Thomlinson" wrote in message ... Create a userform and add two combo boxs to it. Add this code to the form and you will get your two combo boxes... Private Sub UserForm_Initialize() Dim wbk As Workbook For Each wbk In Workbooks ComboBox1.AddItem wbk.Name ComboBox2.AddItem wbk.Name Next wbk End Sub -- HTH... Jim Thomlinson "davegb" wrote: I want to create a userform to display 2 dropdown lists, both with all currently opened XL files in the list, so the user can select 2 files to compare. I've tried reverse engineering Chip Pearson's code in his "Compare" macro, but it's just beyond my current skill level. And I looked for information in this NG, but couldn't find a solution, probably I just don't know how to phrase the search criteria correctly. I have almost no experience with forms in XL, other than creating a simple form to ask the user for input and put the data in a cell. But I do know how to create a basic form. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find files from a dropdown list | Excel Worksheet Functions | |||
Excell Dropdown List. Display alternate text than found in list. | Excel Discussion (Misc queries) | |||
Dropdown list doesn't display from the top of the list | Excel Discussion (Misc queries) | |||
dropdown list...no help in the help files | New Users to Excel | |||
How do I change the size of font/display in a dropdown list I've . | Excel Programming |