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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,630
Messages
6,173,454
Members
452,514
Latest member
cjkelly15

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