I have a bunch of activex text boxes and what I would like to do is change the number format for a specific number of text boxes.
Ultimately I just want one subroutine that I can code all the textboxes of my choice - textbox1, textbox2, textbox15 - the number of textbox is irrelevant and the number format will be as "###,###,###". For example...
Private sub textNumFormat_<whatever>()
TextBox1.Text = Format(TextBox1.Text, "###,###,###")
TextBox2.Text = Format(TextBox2.Text, "###,###,###")
TextBox15.Text = Format(TextBox5.Text, "###,###,###")
end sub
I'm trying to avoid not having a bunch of textbox subs. Example
Private Sub TextBox1_Change()
TextBox1.Text = Format(TextBox1.Text, "###,###,###")
End Sub
and then another sub...
Private Sub TextBox2_Change()
TextBox2.Text = Format(TextBox2.Text, "###,###,###")
End Sub
and another sub...
Private Sub TextBox15_Change()
TextBox15.Text = Format(TextBox15.Text, "###,###,###")
End Sub
hope it makes sense. Thanks!
I tried:
Private Sub TextBox1_Change()
TextBox1 = Format(TextBox1.Value, "###,###,###")
TextBox2 = Format(TextBox1.Value, "###,###,###")
TextBox5 = Format(TextBox1.Value, "###,###,###")
TextBox10 = Format(TextBox1.Value, "###,###,###")
End Sub
but it doesn't work.
I also tried creating a general sub name and putting the format code, but didn't work either.
If someone could help me out, that would be greatly appreciated.
Thanks.