View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Capture a number from a cell containing numbers and letters

On 23 Jan 2007 10:04:20 -0800, "Khurram" wrote:

Hi all,
I need to capture the number from a cell that contains data in the
format "2.45 Days" or "3.6 Days". Is it possible to somehow remove the
"Days" elements and capture all else? I am doing this programatically
using VBA.

Thank you kindly

Khurram


So long as the format is as you show, with the numeric value coming first, the
Val function will return only the number:

e.g.

Debug.Print Val("3.6 days")
-- 3.6


--ron