Solved

Concatenate 2 userform comboboxes to a userform text box

Posted on 2016-09-05
4
49 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
  • 2
  • 2
4 Comments
 
LVL 28

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 28

Expert Comment

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now