View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Text Counter as you type

put in a textbox from the control toolbox toolbar

Right click on it and select view code.

Put in code like this: (assumes the name is Textbox1)

Private Sub TextBox1_Change()
If Len(TextBox1.Text) 30 Then
TextBox1.Value = Left(TextBox1.Text, 30)
End If
Set rng = TextBox1.TopLeftCell.Offset(0, -1)
rng.Value = "'" & Len(TextBox1.Text) & "/30"
End Sub

--
regards,
Tom Ogilvy


"jeffbert" wrote:

Not to wear out your patience, but I am an extreme novice in VB. Do you have
a sample of the code I could manipulate?

Thanks again


"Tom Ogilvy" wrote:

Yes. A textbox from the control toolbox toolbar has a Change event that
fires on each keystroke, so this would support what you want to do.

--
Regards,
Tom Ogilvy


"jeffbert" wrote:

So if I entered a text box, would this be possible?

If not, what is the most practical way to achive this?



"Tom Ogilvy" wrote:

macros don't run (for any practical purpose) while a user is editing a cell.

--
Regards,
Tom Ogilvy


"jeffbert" wrote:

Is there a way to make a cell have a character counter? The cell is validated
to only allow 30 characters. I need to put in a counter that as the person
types, it shows they are on character "13/50" and keeps counting as they type.