How can I make my code add text the the front or left of a textbox on a userform?

vbaNumpty

Board Regular
Joined
Apr 20, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
I have a checkbox on a userform and I would like for it to add text to a text box, without replacing the contents if there already is something in the textbox.

I would like for it to be added to the left most of the textbox, essentially being the first text that is viewed when reading the contents.

I have used an if to make the textbox1.text= abc, but I don't want to replace all the contents when there are already some notes in the textbox.

For example if the textbox had the following in it Customer Wants Blue Pots

The end result would be : abc - Customer Wants Blue Pots
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I have tried the following but I get an object error:

VBA Code:
Private Sub NeedReview_Change()

    Dim existingNotes As String
    
    Set existingNotes = NotesBox.Value

    If NeedReview.Value = True Then NotesBox.Text = "NEEDS REVIEW - " & existingNotes
    
    

End Sub
 
Upvote 0

Forum statistics

Threads
1,213,524
Messages
6,114,117
Members
448,549
Latest member
brianhfield

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