How to type numbers in textbox and not type other value in excel userform in excel?
Answers
Molecular mass of H2O = 18g/mol
Numbers of molecules present in 18g of H2O =6.022×10^23 molecules
Numbers of molecules present in 0.9g of
H2O = 6.022×10^23×18×0.9 molecules
Numbers of atom in 1 molecule 3(2hydrogen and 1 oxygen)
Number of atoms in
6.022×10^23×18×0.9 molecules of
H2O =
6.022×10^23×0.9×3
= 9.03×10^22 atoms.
Hope this helps you ☺️☺️❤️❤️✌️✌️
To type numbers in in textbox and not type other value in excel user form in excel you can try these codes.
Private Sub TextBox1_Change()
OnlyNumbers
End Sub
Private Sub TextBox2_Change()
OnlyNumbers
End Sub
Private Sub TextBox3_Change()
OnlyNumbers
End Sub
Private Sub OnlyNumbers()
If TypeName(Me.ActiveControl) = ""TextBox"" Then
With Me.ActiveControl
If Not IsNumeric(.Value) And .Value <> vbNullString Then
MsgBox ""Sorry, only numbers allowed""
.Value = vbNullString
End If
End With
End If
End Sub