View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alberto Ast[_2_] Alberto Ast[_2_] is offline
external usenet poster
 
Posts: 181
Default Validata a variable

I need to validate a cell contains only numbers from the 3rd position to the
forth. I have below statement to convert to number but if there is an
alfanumeric value the macro fails.

myVal = Mid(wb.Sheets("AOS Form").Range("Q2").Value, 3, 4) * 1

How do I do it?