Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code for combo box

Hi,
I have 6 combo boxes on a spreadsheet. I would like the user to be able to
pick up to 15 items from any of these combo boxes and store the information
in a separate column on the worksheet. I was able to code one combo box to
get the data into a column, but when I copy this code to another combo box
and select a value, the selected value starts at the top of the column, when
I would like it to start in the next available empty cell in the column.
Below is the code I am using in one combo box:
Private Sub ListBox_StateReg_dblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer, icount As Integer

For i = 0 To ListBox_StateReg.ListCount - 1
If ListBox_StateReg.Selected(i) Then
icount = icount + 1

Cells(icount, 16) = ListBox_StateReg.list(i)

End If
Next i
End Sub
Any help would be greatly appreciated

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default code for combo box

Private Sub ListBox_StateReg_dblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer, icount As Integer

iCount=Cells(Rows.Count,16).End(xlUp).Row
If iCount = 1 And Cells(iCount,16).Value = "" then
Else
iCount=iCount + 1
End If

For i = 0 To ListBox_StateReg.ListCount - 1
If ListBox_StateReg.Selected(i) Then
icount = icount + 1

Cells(icount, 16) = ListBox_StateReg.list(i)

End If
Next i
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"combo box question" <combo box wrote in
message ...
Hi,
I have 6 combo boxes on a spreadsheet. I would like the user to be able to
pick up to 15 items from any of these combo boxes and store the

information
in a separate column on the worksheet. I was able to code one combo box to
get the data into a column, but when I copy this code to another combo box
and select a value, the selected value starts at the top of the column,

when
I would like it to start in the next available empty cell in the column.
Below is the code I am using in one combo box:
Private Sub ListBox_StateReg_dblClick(ByVal Cancel As

MSForms.ReturnBoolean)
Dim i As Integer, icount As Integer

For i = 0 To ListBox_StateReg.ListCount - 1
If ListBox_StateReg.Selected(i) Then
icount = icount + 1

Cells(icount, 16) = ListBox_StateReg.list(i)

End If
Next i
End Sub
Any help would be greatly appreciated



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code for combo box

Bob,
Worked like a charm! Thanks for your help.
Joe

"Bob Phillips" wrote:

Private Sub ListBox_StateReg_dblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Integer, icount As Integer

iCount=Cells(Rows.Count,16).End(xlUp).Row
If iCount = 1 And Cells(iCount,16).Value = "" then
Else
iCount=iCount + 1
End If

For i = 0 To ListBox_StateReg.ListCount - 1
If ListBox_StateReg.Selected(i) Then
icount = icount + 1

Cells(icount, 16) = ListBox_StateReg.list(i)

End If
Next i
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"combo box question" <combo box wrote in
message ...
Hi,
I have 6 combo boxes on a spreadsheet. I would like the user to be able to
pick up to 15 items from any of these combo boxes and store the

information
in a separate column on the worksheet. I was able to code one combo box to
get the data into a column, but when I copy this code to another combo box
and select a value, the selected value starts at the top of the column,

when
I would like it to start in the next available empty cell in the column.
Below is the code I am using in one combo box:
Private Sub ListBox_StateReg_dblClick(ByVal Cancel As

MSForms.ReturnBoolean)
Dim i As Integer, icount As Integer

For i = 0 To ListBox_StateReg.ListCount - 1
If ListBox_StateReg.Selected(i) Then
icount = icount + 1

Cells(icount, 16) = ListBox_StateReg.list(i)

End If
Next i
End Sub
Any help would be greatly appreciated




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
Combo Box Code Neil Pearce Excel Discussion (Misc queries) 3 January 5th 09 04:20 PM
Combo Box Code jd815 Excel Discussion (Misc queries) 1 September 14th 05 08:53 PM
Combo Box Code... younathan[_3_] Excel Programming 0 October 19th 04 01:46 PM
Combo Box Code... younathan[_2_] Excel Programming 0 October 19th 04 01:20 PM
Combo Box Code... younathan Excel Programming 1 October 18th 04 08:26 PM


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