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

Fujitsu Lifebook P727 laptop review

Lightwell software lets you create mobile apps without using code

Best value Mac: Which is the best £1249 Mac to buy

Comment désactiver les programmes qui s'exécutent au démarrage de Windows 10 ?