Word Count in UserForm

  Desert Andy 16:13 19 Dec 07
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 07

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 07

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.

How to get Windows 10 for free | How to install Windows 10: There is still a way to avoid paying…

1995-2015: How technology has changed the world in 20 years

Alex Chinneck’s giant ice cube Christmas tree at Kings Cross

Apple rumours & predictions 2017: The iPhone 8, new iPads, and everything else you should expect fr7…