Paste value from userform TextBox to another Textbox

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,689
Office Version
  1. 2007
Platform
  1. Windows
On my userform i wish to copy values from various Textboxes & place in another TextBOx without overwriting the previous,

Example.
TextBox1 value HAPPY
TextBox2 value NEW
TextBox3 value YEAR

I have this code on one command button
Rich (BB code):
Private Sub CommandButton1_Click()
Me.[TextBox3] = Me.[TextBox1]
End Sub

It copies the value fine & places it in TextBox3 fine.

When i use the next command button to copy another TextBox value it places the value in TextBox 3 but overwrites the previous.

So it did show HAPPY but now just shows NEW
What code do i need to use to just keep what was there & paste the new value at the end
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try
Private Sub CommandButton1_Click()
Me.[TextBox3] =Me.[TextBox3] & " " & Me.[TextBox1]
End Sub
 
Upvote 0
Don't get into lazy habits, like using brackets instead of specifying properties:

Me.TextBox3.Value =Me.TextBox3.Value & " " & Me.TextBox1.Value
 
Upvote 0
Hi,
Ived used the code on CommandButton 2 & 3 BUT i need to also use it on CommandBUtton4

At present this is the code on CommandButton4 so not sure how to apply it,please advise thanks.

Rich (BB code):
Private Sub CommandButton4_Click()
  Dim specialWord As String
  specialWord = " ""?"""
  TextBox3.TEXT = Replace(specialWord, "?", TextBox1.TEXT)
End Sub
 
Upvote 0
The code currently in TextBox3 is shown in photo number 1
When i run the command button code as shown in post 4 my text is replaced & the new value is now in TextBox3 see photo 2
Im looking to have it placed at the end of the current code not replace current code
 

Attachments

  • 1.jpg
    1.jpg
    83.2 KB · Views: 11
  • 2.jpg
    2.jpg
    84.2 KB · Views: 11
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top