Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a pair of comboboxes that i would like to fill using Rowsource. I
need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This worked for me. I put the combo boxes on Sheet 1 but it should
work on a userform as well. Just change from Sheet(1) to UserForm1. Sub hideSh() ActiveWorkbook.Worksheets(2).Visible = False ActiveWorkbook.Sheets(3).Visible = False Sheets(1).ComboBox1.ListFillRange = "Sheet2!b2:b4" Sheets(1).ComboBox2.ListFillRange = "Sheet3!c2:c4" End Sub "Office_Novice" wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use code:
Option Explicit Private Sub UserForm_Initialize() Dim myRng As Range With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row) End With With Me.ComboBox1 .ColumnCount = myRng.Columns.Count .RowSource = myRng.Address(external:=True) End With End Sub Or you could just type the address into the combobox's rowsource property: 'sheet 1'!a1:E99 Office_Novice wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I Cant Get either of these to work. What am i doing wrong?
"Dave Peterson" wrote: You could use code: Option Explicit Private Sub UserForm_Initialize() Dim myRng As Range With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row) End With With Me.ComboBox1 .ColumnCount = myRng.Columns.Count .RowSource = myRng.Address(external:=True) End With End Sub Or you could just type the address into the combobox's rowsource property: 'sheet 1'!a1:E99 Office_Novice wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is myRng being set to what you want? I would use the following instead
(untested) With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range(.Cells(1,1), .Cells(.Rows.Count, 1).End(xlUp).offset(0,4)) End With Then check myRng with Msgbox myRng.address Bob Flanagan Macro Systems 144 Dewberry Drive Hockessin, Delaware, U.S. 19707 Phone: 302-234-9857, cell 302-584-1771 http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Office_Novice" wrote in message ... I Cant Get either of these to work. What am i doing wrong? "Dave Peterson" wrote: You could use code: Option Explicit Private Sub UserForm_Initialize() Dim myRng As Range With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row) End With With Me.ComboBox1 .ColumnCount = myRng.Columns.Count .RowSource = myRng.Address(external:=True) End With End Sub Or you could just type the address into the combobox's rowsource property: 'sheet 1'!a1:E99 Office_Novice wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't know.
What is the name of the worksheet that holds the data? What is the address of the range that holds the data? What happens when you tried each of them? Office_Novice wrote: I Cant Get either of these to work. What am i doing wrong? "Dave Peterson" wrote: You could use code: Option Explicit Private Sub UserForm_Initialize() Dim myRng As Range With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row) End With With Me.ComboBox1 .ColumnCount = myRng.Columns.Count .RowSource = myRng.Address(external:=True) End With End Sub Or you could just type the address into the combobox's rowsource property: 'sheet 1'!a1:E99 Office_Novice wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
WorkSheet Name = Cash
Range = The range is dynamic but it is in column A Nothing happens "Dave Peterson" wrote: I don't know. What is the name of the worksheet that holds the data? What is the address of the range that holds the data? What happens when you tried each of them? Office_Novice wrote: I Cant Get either of these to work. What am i doing wrong? "Dave Peterson" wrote: You could use code: Option Explicit Private Sub UserForm_Initialize() Dim myRng As Range With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row) End With With Me.ComboBox1 .ColumnCount = myRng.Columns.Count .RowSource = myRng.Address(external:=True) End With End Sub Or you could just type the address into the combobox's rowsource property: 'sheet 1'!a1:E99 Office_Novice wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. -- Dave Peterson -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What did you use in code?
What did you type into that rowsource manually? Office_Novice wrote: WorkSheet Name = Cash Range = The range is dynamic but it is in column A Nothing happens "Dave Peterson" wrote: I don't know. What is the name of the worksheet that holds the data? What is the address of the range that holds the data? What happens when you tried each of them? Office_Novice wrote: I Cant Get either of these to work. What am i doing wrong? "Dave Peterson" wrote: You could use code: Option Explicit Private Sub UserForm_Initialize() Dim myRng As Range With ThisWorkbook.Worksheets("Sheet 1") Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row) End With With Me.ComboBox1 .ColumnCount = myRng.Columns.Count .RowSource = myRng.Address(external:=True) End With End Sub Or you could just type the address into the combobox's rowsource property: 'sheet 1'!a1:E99 Office_Novice wrote: I have a pair of comboboxes that i would like to fill using Rowsource. I need the source of each to be on different sheets that are hidden. I have about given up. Any help woul be great. -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ComboBox on a UserForm | Excel Worksheet Functions | |||
UserForm ComboBox | Excel Programming | |||
Combobox userform help please | Excel Programming | |||
combobox and userform help! | Excel Programming | |||
Userform w/ComboBox | Excel Discussion (Misc queries) |