Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Populating a combobox within a form with concatenated data

Hi Everyone,

I am by no means an expert on VBA programming and was hoping someone
could help me out (am desperate!). Is there any way to populate a
ComboBox within a form with concatenated data? I am able to
concatenate data on a worksheet, but can't figure out how to
incorporate this function within a form. With prior assistance, I was
able to populate a ComboBox with "regular" worksheet data using the
following code:

---------------------------------------------------------------------------------
Private Sub UserForm7Combobox1_Initialize()
Dim i As Long
Dim S1 As Worksheet

Set S1 = Worksheets("DataEntry")

For i = 2 To S1.Range("A2").End(xlDown).Row
UserForm7.ComboBox1.AddItem S1.Cells(i, 1).Value
Next i

End Sub
-----------------------------------------------------------------------------------
As written, the data in column "A" are just last names. I would like
to join that info with three other non-consecutive columns of data
(columns A,B,C,F) using a For/Next loop, like the one above.

If I were to do this on a worksheet (which I can't with this project)
it would look something like this: =concatenate (A2, ", " , B2, C2, ".
" , F2)
The first value returned in worksheet column "BD" would be equal to:
Neuman, Alfred E. 123456789

I would like to populate my ComboBox (using the above coding ) with the
concatenated data in column "BD" rather than column "A".

My main question is: can I just insert a single line of code to
concatenate my data into the above subroutine? If so, what would be
the correct syntax?

If I can get this figured out, the rest of my project will be a piece
of cake. Otherwise, I'm screwed!

Thank you for your time,
Jeff

  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Populating a combobox within a form with concatenated data

edit


UserForm7.ComboBox1.AddItem S1.Cells(i, 1).Value
to look like this



UserForm7.ComboBox1.AddItem S1.Cells(i, 1) +
","+s1.cells(i,2)+s1.cells(i,3)+"," + s1.cells(i,6)



--
When you lose your mind, you free your life.


" wrote:

Hi Everyone,

I am by no means an expert on VBA programming and was hoping someone
could help me out (am desperate!). Is there any way to populate a
ComboBox within a form with concatenated data? I am able to
concatenate data on a worksheet, but can't figure out how to
incorporate this function within a form. With prior assistance, I was
able to populate a ComboBox with "regular" worksheet data using the
following code:

---------------------------------------------------------------------------------
Private Sub UserForm7Combobox1_Initialize()
Dim i As Long
Dim S1 As Worksheet

Set S1 = Worksheets("DataEntry")

For i = 2 To S1.Range("A2").End(xlDown).Row
UserForm7.ComboBox1.AddItem S1.Cells(i, 1).Value
Next i

End Sub
-----------------------------------------------------------------------------------
As written, the data in column "A" are just last names. I would like
to join that info with three other non-consecutive columns of data
(columns A,B,C,F) using a For/Next loop, like the one above.

If I were to do this on a worksheet (which I can't with this project)
it would look something like this: =concatenate (A2, ", " , B2, C2, ".
" , F2)
The first value returned in worksheet column "BD" would be equal to:
Neuman, Alfred E. 123456789

I would like to populate my ComboBox (using the above coding ) with the
concatenated data in column "BD" rather than column "A".

My main question is: can I just insert a single line of code to
concatenate my data into the above subroutine? If so, what would be
the correct syntax?

If I can get this figured out, the rest of my project will be a piece
of cake. Otherwise, I'm screwed!

Thank you for your time,
Jeff


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Populating a combobox within a form with concatenated data

You're AWESOME!!!

Thanks Ben!

Jeff

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 populating problem Werner[_33_] Excel Programming 1 July 29th 05 10:00 PM
Populating a ComboBox DirInfo Excel Programming 1 March 17th 05 10:03 PM
Populating ComboBox Methods Todd Huttenstine[_2_] Excel Programming 8 January 19th 04 12:14 AM
Populating Combobox Methods Todd Huttenstine[_2_] Excel Programming 10 January 18th 04 10:19 PM
populating a combobox on a worksheet Tim Marsh[_2_] Excel Programming 2 November 3rd 03 12:44 PM


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