mercredi 20 décembre 2017

Fail on following code (Excel VBA) x = 1 If Textbox.Value = x Then ...

Value in TextBox is 1

MsgBox shows 0 after running the code below.

But when I change x1 in fourth code line into 1, MsgBox shows 1 successfully.

Or if I change "TextBox.value" into "Range("A1").Value", MsgBox shows 1 successfully after I put 1 into Range("A1").

As a result, cells seem to understand Variables, but TextBoxes do not?

Question: I would like to know how to make Excel VBA understand that x1 is 1 ?

Dim x1, x3 As Integer
x1 = 1
x3 = 1
If TextBox.value = x1 Then
CT1 = x3
End If
MsgBox CT1

Any advise will be highly appreciated. Thanks

Aucun commentaire:

Enregistrer un commentaire