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

I have a UserForm with a ComboBox. The current RowSource for the ComboBox is
shown below. Is it possible to make the RowSource be the range $P$2:$P$300
of the active worksheet? I have 12 different worksheets that can call this
one UserForm.

'Names'!$P$2:$P$300

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default ComboBox Rowsource question

Define/re-define the row source with

ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"

When you do this needs to be controlled, maybe the worksheet activate event?

--

Regards,
Nigel




"Patrick C. Simonds" wrote in message
...
I have a UserForm with a ComboBox. The current RowSource for the ComboBox
is shown below. Is it possible to make the RowSource be the range
$P$2:$P$300 of the active worksheet? I have 12 different worksheets that
can call this one UserForm.

'Names'!$P$2:$P$300


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default ComboBox Rowsource question

I tried this a few different ways, no of which worked:

Private Sub Worksheet_Activate()
ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"

End Sub

Private Sub Worksheet_Activate()
With UserForm2
ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"
End With
End Sub

Both of which returned an "Object Required error"

And then within the UserForm Initialization, but it returned "Could not set
the RowSource property. Invalid property value"

"Nigel" wrote in message
...
Define/re-define the row source with

ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"

When you do this needs to be controlled, maybe the worksheet activate
event?

--

Regards,
Nigel




"Patrick C. Simonds" wrote in message
...
I have a UserForm with a ComboBox. The current RowSource for the ComboBox
is shown below. Is it possible to make the RowSource be the range
$P$2:$P$300 of the active worksheet? I have 12 different worksheets that
can call this one UserForm.

'Names'!$P$2:$P$300


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default ComboBox Rowsource question

Thanks

With your help I was able to use what you gave me and I was better able to
refine my internet search. It seems that if you put no worksheet reference,
it defaults to the active worksheet.

ComboBox1.RowSource = "$P$7:$P$3000"

"Patrick C. Simonds" wrote in message
...
I tried this a few different ways, no of which worked:

Private Sub Worksheet_Activate()
ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"

End Sub

Private Sub Worksheet_Activate()
With UserForm2
ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"
End With
End Sub

Both of which returned an "Object Required error"

And then within the UserForm Initialization, but it returned "Could not
set the RowSource property. Invalid property value"

"Nigel" wrote in message
...
Define/re-define the row source with

ComboBox1.RowSource = ActiveSheet.Name & "!$P$1:$P$300"

When you do this needs to be controlled, maybe the worksheet activate
event?

--

Regards,
Nigel




"Patrick C. Simonds" wrote in message
...
I have a UserForm with a ComboBox. The current RowSource for the ComboBox
is shown below. Is it possible to make the RowSource be the range
$P$2:$P$300 of the active worksheet? I have 12 different worksheets that
can call this one UserForm.

'Names'!$P$2:$P$300




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBox Rowsource question

I like to let excel do the heavy lifting...

Dim myRng as range
set myrng = activesheet.range("p2:p300")
....

... = myrng.address(external:=true)

------------
If you want to supply the string yourself:
... = "'" & activesheet.name & "'!p2:p300"

(Some names will require those apostrophes.)

"Patrick C. Simonds" wrote:

I have a UserForm with a ComboBox. The current RowSource for the ComboBox is
shown below. Is it possible to make the RowSource be the range $P$2:$P$300
of the active worksheet? I have 12 different worksheets that can call this
one UserForm.

'Names'!$P$2:$P$300


--

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 RowSource Caleb Runnels Excel Programming 4 July 22nd 07 10:47 PM
ComboBox RowSource Question Mike Samyn Excel Programming 3 August 10th 06 11:04 PM
UserForm ComboBox RowSource Question Minitman[_4_] Excel Programming 0 November 15th 05 07:03 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
combobox rowsource Newbie Excel Programming 1 September 8th 04 12:21 PM


All times are GMT +1. The time now is 10:11 AM.

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

About Us

"It's about Microsoft Excel"