View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default TextBox_Change() problem

I'd use a variable at the top of that userform module:

Option Explicit
Dim BlkProc as boolean
Private Sub Userform_Initialize()

blkproc = true
me.textbox1.value = "hi there"
blkproc = false

End Sub
Private Sub TextBox1_Change()

if blkproc = true then exit sub

blkproc = true
Me.TextBox1.value = UCase(Me.TextBox1.Text)
blkproc = false

OptionButton1.Value = False
OptionButton2.Value = False
OptionButton3.Value = False
OptionButton4.Value = False
OptionButton5.Value = False
OptionButton6.Value = False

End Sub

I like this because I can use the same idea whenever I change that
textbox--including making it uppercase!


"Patrick C. Simonds" wrote:

On my UserForm is TextBox1, which if a user makes a change to the TextBox I
want the value of some OptionButtons set to false. That in its self is easy
enough, using the TextBox1_Change routine below. My problem is that during
UserForm Initialization TextBox1 is populated with the following code:

TextBox1.Value = rng(1, 7).Text

Unfortunately the TextBox1_Change routine sees that as a change and sets
all OptionButtons to False. Any suggestions?

Private Sub TextBox1_Change()

Me.TextBox1 = UCase(Me.TextBox1.Text)

OptionButton1.Value = False
OptionButton2.Value = False
OptionButton3.Value = False
OptionButton4.Value = False
OptionButton5.Value = False
OptionButton6.Value = False

End Sub


--

Dave Peterson