Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Concatenate 2 userform comboboxes to a userform text box

Posted on 2016-09-05
4
Medium Priority
?
105 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 33

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 2000 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 33

Expert Comment

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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

604 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