Repeating text in a text box within Excel.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I write reports quite frequently and a lot of the sentences that I write are
reprtitive. Therefore I am looking a way to optimize my time by automating
these sentences. A minor complication to this entire scenario is that my text
is in a text box.
I could use some help on this. Please.
Thank you
 
You can use AutoCorrect to replace a typed code with a sentence. For
example:

Choose Tools>AutoCorrect Options
In the Replace box, type a code, e.g. cs1
(the code will represent Comment Sentence 1)
In the With box, type the first sentence
Click the Add button, and enter codes and text for the remaining sentences.
Click OK

In a comment, type a code, then press the space bar, or type a
punctuation character. The code will be replaced by the text.
(The AutoCorrect entries will also work on the worksheet, and in other
Office applications.)
 
Hi

Assuming a Control toolbox textbox, if so it's no complication, but rather
"the way to do it".

Make its Keydown code look like this (in the worksheet module for a box on a
worksheet, in the userform module for a box on a userform):

Private Sub TextBox1_KeyDown(ByVal KeyCode _
As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If Shift = 2 Then 'Ctrl
Select Case KeyCode
Case 49 ' Ctrl 1
KeyCode = 0
TextBox1.SelText = _
"Harald says Hi!"
Case 50 'Ctrl 2
KeyCode = 0
TextBox1.SelText = _
"Harald says You're fired!"
Case Else
End Select
End If
End Sub

Now hold Ctrl while typing 1 or 2 into it and text is entered.
HTH. Best wishes Harald
 
Thank you for your help.

Debra Dalgleish said:
You can use AutoCorrect to replace a typed code with a sentence. For
example:

Choose Tools>AutoCorrect Options
In the Replace box, type a code, e.g. cs1
(the code will represent Comment Sentence 1)
In the With box, type the first sentence
Click the Add button, and enter codes and text for the remaining sentences.
Click OK

In a comment, type a code, then press the space bar, or type a
punctuation character. The code will be replaced by the text.
(The AutoCorrect entries will also work on the worksheet, and in other
Office applications.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top