Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Combo Box fill

Hello all,

The UserForm_Initialize sub populates the first combo box. The
cbSPCsheets_Change sub fills the second combo box.

I would like to populate this combo box with all but the sheet seleted in
the first combo box. Is this accomplished by use of the items index number?
If so, would it be better to delete that item in the second combo box or can
it be passed by at fill time?

I guess another option would be to add a check to determine if the same item
is selected in both combo boxes and prompt to make another selection in box
two.

You thoughts and solutions. . .

Hal



Option Explicit

Private Sub UserForm_Initialize()
' Fill cbSPCsheets
Dim cSheets As Integer
Dim i As Integer
cSheets = Sheets.Count
cbSPCsheets.Clear
For i = 1 To cSheets
cbSPCsheets.AddItem Sheets(i).Name
Next
End Sub

Private Sub cbSPCsheets_Change()
' Fill cbDIRsheets
Dim cSheets As Integer
Dim i As Integer
lblDIRlisting.Enabled = True
cbDIRsheets.Enabled = True
cSheets = Sheets.Count
cbDIRsheets.Clear
For i = 1 To cSheets
cbDIRsheets.AddItem Sheets(i).Name
Next
End Sub

Private Sub cbDIRsheets_Change()
cmbCompare.Enabled = True
End Sub

Private Sub cmbCancel_Click()
Unload frmCompareSPCtoDIR
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combo Box fill

For i = 1 To cSheets
if Sheets(i).Name < cbSPCsheets.Value then
cbDIRsheets.AddItem Sheets(i).Name
end if
Next

If the sheet isn't in the choices, then you don't need to worry about a
conflict.
--
Regards,
Tom Ogilvy


"Hal" wrote in message
...
Hello all,

The UserForm_Initialize sub populates the first combo box. The
cbSPCsheets_Change sub fills the second combo box.

I would like to populate this combo box with all but the sheet seleted in
the first combo box. Is this accomplished by use of the items index

number?
If so, would it be better to delete that item in the second combo box or

can
it be passed by at fill time?

I guess another option would be to add a check to determine if the same

item
is selected in both combo boxes and prompt to make another selection in

box
two.

You thoughts and solutions. . .

Hal



Option Explicit

Private Sub UserForm_Initialize()
' Fill cbSPCsheets
Dim cSheets As Integer
Dim i As Integer
cSheets = Sheets.Count
cbSPCsheets.Clear
For i = 1 To cSheets
cbSPCsheets.AddItem Sheets(i).Name
Next
End Sub

Private Sub cbSPCsheets_Change()
' Fill cbDIRsheets
Dim cSheets As Integer
Dim i As Integer
lblDIRlisting.Enabled = True
cbDIRsheets.Enabled = True
cSheets = Sheets.Count
cbDIRsheets.Clear
For i = 1 To cSheets
cbDIRsheets.AddItem Sheets(i).Name
Next
End Sub

Private Sub cbDIRsheets_Change()
cmbCompare.Enabled = True
End Sub

Private Sub cmbCancel_Click()
Unload frmCompareSPCtoDIR
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Combo Box fill

Thanks once again Tom,

Your expertise is greatly appreciated!

Hal

"Tom Ogilvy" wrote:

For i = 1 To cSheets
if Sheets(i).Name < cbSPCsheets.Value then
cbDIRsheets.AddItem Sheets(i).Name
end if
Next

If the sheet isn't in the choices, then you don't need to worry about a
conflict.
--
Regards,
Tom Ogilvy


"Hal" wrote in message
...
Hello all,

The UserForm_Initialize sub populates the first combo box. The
cbSPCsheets_Change sub fills the second combo box.

I would like to populate this combo box with all but the sheet seleted in
the first combo box. Is this accomplished by use of the items index

number?
If so, would it be better to delete that item in the second combo box or

can
it be passed by at fill time?

I guess another option would be to add a check to determine if the same

item
is selected in both combo boxes and prompt to make another selection in

box
two.

You thoughts and solutions. . .

Hal



Option Explicit

Private Sub UserForm_Initialize()
' Fill cbSPCsheets
Dim cSheets As Integer
Dim i As Integer
cSheets = Sheets.Count
cbSPCsheets.Clear
For i = 1 To cSheets
cbSPCsheets.AddItem Sheets(i).Name
Next
End Sub

Private Sub cbSPCsheets_Change()
' Fill cbDIRsheets
Dim cSheets As Integer
Dim i As Integer
lblDIRlisting.Enabled = True
cbDIRsheets.Enabled = True
cSheets = Sheets.Count
cbDIRsheets.Clear
For i = 1 To cSheets
cbDIRsheets.AddItem Sheets(i).Name
Next
End Sub

Private Sub cbDIRsheets_Change()
cmbCompare.Enabled = True
End Sub

Private Sub cmbCancel_Click()
Unload frmCompareSPCtoDIR
End Sub




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
Fill the values in combo box of excel sheet Priyanka Excel Worksheet Functions 0 February 8th 07 09:16 AM
Fill two column combo box Steve Excel Programming 9 November 6th 05 11:41 PM
Fill in Combo Box with range values???? Christiane[_13_] Excel Programming 2 May 27th 04 02:18 PM
Combo Box Fill Range Tim Halligan Excel Programming 1 April 28th 04 07:29 PM
Fill a combo box from a named area on a sheet Phil Walker Excel Programming 1 August 10th 03 05:54 PM


All times are GMT +1. The time now is 02:10 PM.

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"