Text Box in Excel

Alltorc

New Member
Joined
May 17, 2010
Messages
6
Hi there.

How do I add a text box into excel when you click on a specific cell.

What I want to accomplish is that when a user clicks on a certain cell a text box pops up and he is forced to enter a message into the box before it disappears. I want to the message to be displayed on the sheet once he/she has typed it.

Any idea's
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this: right click the sheet tab, select View Code and paste in

Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim s As String
If Target.Address(False, False) = "A1" Then
    Do While s = ""
        s = InputBox("Enter some text")
    Loop
    Target.Value = s
End If
End Sub

Change A1 to suit.
 
Upvote 0
Hi there VoG

Thank you so much for this. Is there anyway to have the text appear in another block besides the targeted address.. So if they click in the cell the text appears in another row?
 
Upvote 0
Sure, change E5 to suit

Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim s As String
If Target.Address(False, False) = "A1" Then
    Do While s = ""
        s = InputBox("Enter some text")
    Loop
    Range("E5").Value = s
End If
End Sub
 
Upvote 0
You could modify one line of VOG's code to read:
Code:
Target.Offset(1,2).Value = s
That would move the text answer over 1 row and 2 columns. You could use variables in place of the (1, 2). Here it is modified VOG's code:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim s As String
If Target.Address(False, False) = "A1" Then
    Do While s = ""
        s = InputBox("Enter some text")
    Loop
    Target.Offset(1, 2).Value = s
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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