Hello
The below code somehow overwrites the formula typed in rangeE1
What i am trying to do is that if i check value as formula then the txtValue should display the Formula if unchecked then it should display the value in textbox
this is like Formula Bar and Cell Value.
Second thing if i type as value then it should display value both in Formual bar and Range E1 ie when checkbox is unchecked
Overwriting should only if i completely make the txtValue Empty or blank and with new values typed in it
SamD
59
The below code somehow overwrites the formula typed in rangeE1
What i am trying to do is that if i check value as formula then the txtValue should display the Formula if unchecked then it should display the value in textbox
this is like Formula Bar and Cell Value.
Second thing if i type as value then it should display value both in Formual bar and Range E1 ie when checkbox is unchecked
Overwriting should only if i completely make the txtValue Empty or blank and with new values typed in it
SamD
Code:
Private Sub txtValues_AfterUpdate()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.Activate
If CheckBoxEnterFormula.Value = True Then
ws.Range("E1").Formula = txtValues.Value
Else
ws.Range("E1").Value = txtValues.Value
End If
End Sub
Private Sub CheckBoxEnterFormula_Click()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.Activate
If CheckBoxEnterFormula.Value = True Then
ws.Range("E1").Formula = txtValues.Value
Else
txtValues.Value = ws.Range("E1").Value
End If
End Sub
Last edited: