Word Count in UserForm

  Desert Andy 16:13 19 Dec 2007
Locked

Hi, I have designed a userform to be used in Excel. The user is required to enter data into a text box, but is limited to 60 letters. Is there a way of giving an actual letter count real time in another text box or maybe a label, to give the user an idea of how many letters he has got left.

  VoG II 20:24 19 Dec 2007

In design mode, right click the text box > View Code. Paste in

Private Sub TextBox1_Change()
TextBox2.Text = 60 - Len(TextBox1.Text) & " characters left"
End Sub

For this to work you need another TextBox called TextBox2.

  VoG II 20:37 19 Dec 2007

Actually I think a Label looks better:

Private Sub TextBox1_Change()
Label1 = 60 - Len(TextBox1.Text) & " characters left"
End Sub

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

iMac Pro review

See iconic duo Smith and Foulkes' epic animation for the BBC's Winter Olympics coverage

iMac Pro review

Idées cadeaux pour geeks et tech addicts