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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,224,813
Messages
6,181,116
Members
453,021
Latest member
Justyna P

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