D
Dag Johansen
Hi,
I have a very boring problem with the RefEdit control;
there seems to be some bug that leads to the control's
state being altered when it's value is read...
To reproduce the behavior, create a userform and add a
label, a refedit and a checkbox. Then paste the following
code into the module:
Private Sub CheckBox1_Change()
Label1.Enabled = CheckBox1.Value
End Sub
Private Sub RefEdit1_Change()
On Error GoTo InvalidRef
Dim val As String
If CheckBox1.Value Then
val = RefEdit1.Value
Label1.Caption = " = " & Evaluate(val)
End If
Exit Sub
InvalidRef:
Err.Clear
Label1.Caption = " #VALUE"
End Sub
Now, when the checkbox is checked RefEdit1_Change will
update a label to reflect the evaluation of the reference.
When the checkbox isn't checked the event handler will
simply exit without doing anything.
Notice how the RefEdit handles switching to other sheets
than the one that was active when showing the modal form.
All is fine if it's value isn't evaluated, but it starts
selecting cells on the wrong worksheet seemingly becuase I
read and evaluate it's Value property...!
I need to evaluate this reference for a function assistant
specifically made for a custom function I provide. Please
help me figure out a way to work around this misbehavior,
it is ruining an otherwise pretty sweet user experience.
Happy monday, if that's possible
Dag
I have a very boring problem with the RefEdit control;
there seems to be some bug that leads to the control's
state being altered when it's value is read...
To reproduce the behavior, create a userform and add a
label, a refedit and a checkbox. Then paste the following
code into the module:
Private Sub CheckBox1_Change()
Label1.Enabled = CheckBox1.Value
End Sub
Private Sub RefEdit1_Change()
On Error GoTo InvalidRef
Dim val As String
If CheckBox1.Value Then
val = RefEdit1.Value
Label1.Caption = " = " & Evaluate(val)
End If
Exit Sub
InvalidRef:
Err.Clear
Label1.Caption = " #VALUE"
End Sub
Now, when the checkbox is checked RefEdit1_Change will
update a label to reflect the evaluation of the reference.
When the checkbox isn't checked the event handler will
simply exit without doing anything.
Notice how the RefEdit handles switching to other sheets
than the one that was active when showing the modal form.
All is fine if it's value isn't evaluated, but it starts
selecting cells on the wrong worksheet seemingly becuase I
read and evaluate it's Value property...!
I need to evaluate this reference for a function assistant
specifically made for a custom function I provide. Please
help me figure out a way to work around this misbehavior,
it is ruining an otherwise pretty sweet user experience.
Happy monday, if that's possible
Dag