Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default UserForm ComboBox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default UserForm ComboBox

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox on a UserForm LLoyd Excel Worksheet Functions 2 February 20th 08 09:01 PM
UserForm ComboBox D Cornett[_2_] Excel Programming 2 July 23rd 07 11:04 PM
Combobox userform help please Chris Excel Programming 1 October 20th 06 04:36 AM
combobox and userform help! dawn Excel Programming 3 October 11th 06 02:08 AM
Userform w/ComboBox D.Parker Excel Discussion (Misc queries) 2 May 6th 05 04:28 PM


All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"