View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Soniya Soniya is offline
external usenet poster
 
Posts: 48
Default Why my code do not work : - (


Still the Same : - (

????!!!!

what works manual do not work by code?

even the recorded code do not work in the second
instance??!!!!

Soniya

-----Original Message-----
soniya..

Either your columns OR B1/C1 contain data that looks

like dates but in
fact are strings(text).

OR

your data or b1/c1 contains timeportions



maybe changing to
x = "=" & range("B1").text
y = "=" & Range("C1").text

or
x = "=" & int(range("B1"))
y = "=" & int(range("C1"))



will help, but I suggest to make sure
u use the same data types in search range
and criteria cells



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Soniya" wrote:

Hi all,

this is what i got while recording macro and worked

fine..

Sheets("IncomeData").Select
Range("A2").Select
Range(Range("A2:F2"), Range("A2:F2").End
(xlDown)).Select
Selection.AutoFilter Field:=5,
Criteria1:="=01/07/2003", Operator:=xlAnd _
, Criteria2:="<=01/08/2003"

But when I changed it to:

x= "=" & range("B1")
y = "=" & Range("C1")

Range(Range("A2:F2"), Range("A2:F2").End
(xlDown)).Select
Selection.AutoFilter Field:=5, Criteria1:=x,
Operator:=xlAnd _
, Criteria2:=y

then no record shows in the filtered data.. while

there
are several records meet the condition..

What would be the possible reason for this strange
behaviour...?

(I am using XL XP)

TIA
Soniya



.