Solved

Concatenate 2 userform comboboxes to a userform text box

Posted on 2016-09-05
4
79 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 31

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 31

Expert Comment

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

707 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