View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default extract formula result form cell without running formula again

On Tue, 11 Aug 2009 09:54:04 -0700 (PDT), jason
wrote:

ron,
thanks for taking the time.
i realize how trivial the question seems.
basically:

cells(1,1)=4/8/2009
cells(1,1).numberformat="m/d/yy;@"
cells(1,1) [DISPLAYS] 4/8/09
i want to extract JUST 4/8/09
not 4/8/2009

this is my issue.
i've tried .text and .value

not sure, but any help would be huge.
thanks


I'm probably still not understanding what it is you want to do, but your
example is simple enough.

If you want to extract the result as Excel has formatted it, merely use the
..text property.

e.g:

=========================
ption Explicit
Sub foo()
Dim s As String
With Cells(1, 1)
.Value = DateSerial(2009, 4, 8)
.NumberFormat = "m/d/yy;@"
End With
s = Cells(1, 1).Text
Debug.Print s
End Sub
==============================

The immediate window will show 4/8/09
--ron