Conver text to number in VBA

  • Thread starter Thread starter MSN
  • Start date Start date
M

MSN

Hi,

How to convert "1995" (text) to 1995 (number) in VBA?

Thanks.
Sam
 
activecell.Numberformat = "General"
activecell.value = activecell.value


or if it is a variable

Dim sStr as String
Dim vVal as Variant
Dim dblVal as Double
sStr = "1995"
vVal = cdbl(sStr)
'or
dblVal = sStr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top