View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Taking control from Option Button into RefEdit in Excel 2010 behaving oddly

This works for me...

Private Sub opt1_Click()
With Me.RefEdit1
.Enabled = True: .SetFocus
End With
End Sub

Private Sub opt2_Click()
With Me.RefEdit1
.Enabled = True: .SetFocus
End With
End Sub

Private Sub opt3_Click()
With Me.RefEdit1
.Enabled = True: .SetFocus
End With
End Sub

Private Sub UserForm_Click()
Me.RefEdit1.Enabled = False
End Sub

Private Sub UserForm_Initialize()
Me.RefEdit1.Enabled = False
End Sub

...when clicking outside the RefEdit, then going back to choose another
option.

If setting state is needed then I recommend you use a separate routing
to manage that, and call that routine from the opt_Click event...

Private Sub opt1_Click()
With Me.RefEdit1
.Enabled = True: .SetFocus
End With
Call SetCtrlState(Ndx:=Me.opt1.Tag)
End Sub

Sub SetCtrlState(Ndx&)
Select Case Ndx
Case Is = 1: '//do this...
Case Is = 2: '//do that...
Case Is = 3: '//do some other thing...
End Select 'Case Ndx
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com