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

Is it possible to set the RowSource for a ComboBox based on a condition?

For ComboBox1 I would like to set the RowSource as follows:

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sat then
Rowsource would be 'Routes'!$E$2:$E$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sun then
Rowsource would be 'Routes'!$H$2:$H$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") did not equal
Sat or Sun then Rowsource would be 'Routes'!$B$2:$B$61


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Set RowSource

Hi

It can be done like this:

Select Case ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3")
Case "Sat"
Me.ComboBox1.RowSource = "'Routes'!$E$2:$E$61"
Case "Sun"
Me.ComboBox1.RowSource = "'Routes'!$H$2:$H$61"
Case Else
Me.ComboBox1.RowSource = "'Routes'!$B$2:$B$61"
End Select

Regards,
Per


On 6 Jan., 20:17, "ordnance1" wrote:
Is it possible to set the RowSource for a ComboBox based on a condition?

For ComboBox1 I would like to set the RowSource as follows:

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sat then
Rowsource would be *'Routes'!$E$2:$E$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sun then
Rowsource would be *'Routes'!$H$2:$H$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") did not equal
Sat or Sun then Rowsource would be *'Routes'!$B$2:$B$61


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Set RowSource

Thanks for the help

"Per Jessen" wrote in message
...
Hi

It can be done like this:

Select Case ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3")
Case "Sat"
Me.ComboBox1.RowSource = "'Routes'!$E$2:$E$61"
Case "Sun"
Me.ComboBox1.RowSource = "'Routes'!$H$2:$H$61"
Case Else
Me.ComboBox1.RowSource = "'Routes'!$B$2:$B$61"
End Select

Regards,
Per


On 6 Jan., 20:17, "ordnance1" wrote:
Is it possible to set the RowSource for a ComboBox based on a condition?

For ComboBox1 I would like to set the RowSource as follows:

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sat then
Rowsource would be 'Routes'!$E$2:$E$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sun then
Rowsource would be 'Routes'!$H$2:$H$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") did not equal
Sat or Sun then Rowsource would be 'Routes'!$B$2:$B$61


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Set RowSource

I will assume that Combobox1 is located on a Userform. If that is the case,
put this in the Userforms Intialize Event. Hope this helps! If so, let me
know, click "YES" below.

Private Sub UserForm_Initialize()

Select Case ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3").Value

Case Is = "Sat"
Me.ComboBox1.RowSource = "'Routes'!$E$2:$E$61"
Case Is = "Sun"
Me.ComboBox1.RowSource = "'Routes'!$H$2:$H$61"
Case Else
Me.ComboBox1.RowSource = "'Routes'!$B$2:$B$61"
End Select

End Sub
--
Cheers,
Ryan


"ordnance1" wrote:

Is it possible to set the RowSource for a ComboBox based on a condition?

For ComboBox1 I would like to set the RowSource as follows:

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sat then
Rowsource would be 'Routes'!$E$2:$E$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") = Sun then
Rowsource would be 'Routes'!$H$2:$H$61

If ActiveWorkbook.Worksheets("FR Launch Sheet").Range("B3") did not equal
Sat or Sun then Rowsource would be 'Routes'!$B$2:$B$61


.

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
RowSource as a row Boba Excel Programming 4 July 16th 07 09:48 PM
XLA and Listbox.rowsource Sven[_8_] Excel Programming 2 May 21st 07 09:54 PM
RowSource Patrick Simonds Excel Programming 1 August 5th 06 01:25 AM
help with rowsource GMet Excel Programming 4 September 24th 04 02:30 PM
Using IF, Then with rowsource? CAA[_23_] Excel Programming 8 April 4th 04 08:56 PM


All times are GMT +1. The time now is 03:23 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"