Empty textbox needs text

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a regular textbox (Shape, not an active x textbox) that needs to have the text "Please type notes here" if it doesn't have anything in it. I also need the text to disappear when you click in it so it is ready to type into. Could someone help me with the vba code please?
 

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)
Right click in and Edit Text to set the text. OR, for part 2, put this in a Module and Assign it by right clicking it. Then left click to add the text.
Code:
Sub Rectangle1_Click()
    With ActiveSheet.Shapes("Rectangle 1")
        .TextFrame.Characters.Text = ""
        .Select
    End With
End Sub
 
Upvote 0
But I can just left click in it to edit the text.
 
Upvote 0
I also need the text to reappear if everything is deleted.
 
Upvote 0
That is the limitation when using shapes. We can use a sledge hammer on it. Right click the sheet's tab, View Code, and paste.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With ActiveSheet.Shapes("Rectangle 1").TextFrame.Characters
        If .Text = "" Then .Text = "Please type notes here"
    End With
End Sub
 
Upvote 0
That didn't seem to work. I am trying another way. What is the code to make a border of the text box invisible?
 
Upvote 0
When I click on the box in your file I get the error Invalid procedure call or argument.
 
Upvote 0
I like it when answers are provided in the forum and not in links to files.
I have been following this thread but do not plan to click on links to files.
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,085
Members
448,548
Latest member
harryls

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