I want to "freeze" the cell after clicking the box. The statement i want to have in the cell doesn't work. I always get runtime error 1004, the error is the If-statement. Here the code:
Private Sub CheckBox1_Click()
If Range("H1").HasFormula Then
Range("H1").Value = Range("H1").Value
Me.CheckBox1.Caption = "Unfreeze"
Else
Range("H1").Formula = "=IF(Sheet2!E1 = 12;Sheet2!E1;"")"//If value in E1 is 12, H1 = 12 otherwise the cell stays empty
Me.CheckBox1.Caption = "Freeze"
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire