?
Solved

Concatenate 2 userform comboboxes to a userform text box

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

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 32

Expert Comment

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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

752 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