View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_423_] joel[_423_] is offline
external usenet poster
 
Posts: 1
Default vba autofilter problem


Autofilter uses a string when comparing and the value number of a cell
with a date is a number. The number will not match the string. the
best solution is this

From :

Cells.AutoFilter Field:=4,
Criteria1:=Sheets("Worksheet").Range("Q2").Value


To :
DateStr = format(Sheets("Worksheet").Range("Q2").Value,"mm-dd-yy")
Cells.AutoFilter Field:=4,
Criteria1:=DateStr


The "mm-dd-yy" must match the format of the data in the worksheet.
Change the format as required.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=165290

Microsoft Office Help