View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David McRitchie
 
Posts: n/a
Default Sort : how can I use a variable in a VB sort function?

Hi El,
See last topic in Chip Pearson's
http://www.cpearson.com/excel/DateTimeVBA.htm

you have to effectively use a dateserial number the actual stored value of the date
as days past Dec 31, 1899 as recorded internally in Excel (actually it's the wrong value).

--
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"El Bee" wrote in message ...
If I create a variable and call it End_date how can I use it in the sort
function?
I want to replace the "02/26/06" value with this variable. I've tried just
replacing it with Cells.Find(What:=End_date,..... and it fails. I've also
tried placing it in brackets and that fails too.

Cells.Find(What:="02/26/06", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate