View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Excel fraction not a date

The equal sign makes it a fraction. The below works fine for me.

Sub frac()
Selection.Formula = "=1/4"
Selection.Value = Selection.Value
End Sub

as does manual entry
=1/4

This could be affected by the settings in the transition tab of
tools=options.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

It does not matter if its VBA or on the worksheet:

Sub frac()
Selection.Formula = "= 1/4"
Selection.Value = Selection.Value
End Sub


The space makes it a fraction and not a date. Format the cell to carrry the
proper number of digits in the numerator and denominator.
--
Gary''s Student - gsnu200724


"FGM" wrote:

Windows 2000, Excel 2003
How do you get excel to use a fraction as a fraction and not a date? I am
using a function that returns a fraction as a string. I then copy it and
paste it in a new cell as value.. I have tried formating the cell as a
decimal, as a fraction, it just keeps it as text or views it as a date....
any help would be appreciated.
Thanks.