Solved

Concatenate 2 userform comboboxes to a userform text box

Posted on 2016-09-05
4
70 Views
Last Modified: 2016-09-05
Guys, This is probably very simple but the answer isn't jumping out at me.

Within my excel 2016 workbook I have a button named "Delete" this opens up a userform it has 3 fields Month, Year & Result.

What I want to happen here is when I choose Month and Year I want these 2 values to appear in the Result text box in this format

03-2016   "Ie add the "-" between the month and year.

Any Help please
insert-into-oracle.xlsm
0
Comment
Question by:DarrenJackson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41784814
Place the following code on the UserForm module and see if this is what you are trying to achieve...

Private Sub ComboBox1_Change()
If Me.ComboBox1 <> "" And Me.ComboBox2 <> "" Then
   Me.TextBox1 = Me.ComboBox1 & "-" & Me.ComboBox2
Else
   Me.TextBox1 = ""
End If
End Sub

Private Sub ComboBox2_Change()
If Me.ComboBox1 <> "" And Me.ComboBox2 <> "" Then
   Me.TextBox1 = Me.ComboBox1 & "-" & Me.ComboBox2
Else
   Me.TextBox1 = ""
End If
End Sub

Open in new window

0
 

Author Comment

by:DarrenJackson
ID: 41784821
Perfect thank you for the quick response
0
 

Author Closing Comment

by:DarrenJackson
ID: 41784822
Thankyou
0
 
LVL 30

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41784823
You're welcome Darren! Glad to help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question