I want to use Type to find the value in cell A12, with an IF statement. I need something like "If Type (A12)= 1 Then"...etc. What is the syntax for this ?
Determine Data Type Function
If you are wanting to use a formula, you can use
For a coding wayCode
If IsNumeric(Range("A1")) = True Then If Range("A1") = 1 Then 'Do Something here Else 'do something else End If Else MsgBox "Not A Valid Number" End If
Is This what you are looking for? Usually Type refers to some type of control, so I do not know if you have a control on the sheet and you are trying to determine what type of control it is.
AFAIK the worksheet function Type cannot be used in VBA. As bnix suggests you will need to use the various VBA formulas starting with IS to determine the type of entry in a cell.
Sorry. I thought the function Type was available in VB. I shall stick with IsNumeric.
Don’t have an account yet? Register yourself now and be a part of our community!