Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Why my code do not work : - (

Soniya,

Try this

x = "=" & Format(Range("B1"),"dd/mm/yyyy")
y = "<=" & Format(Range("C1"),"dd/mm/yyyy")
or
x = "=" & CStr(Range("B1"))
y = "<=" & CStr(Range("C1"))

--

HTH

Bob Phillips

"Soniya" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maco code doesn't work. Why? Joe M. Excel Discussion (Misc queries) 2 January 13th 10 07:13 PM
Why does this code not work? rk0909 Excel Discussion (Misc queries) 12 September 4th 08 10:42 PM
Event code won't work marker68 Excel Discussion (Misc queries) 2 April 2nd 08 01:13 AM
Why this code is not work? Error code when select worksheet Excel Worksheet Functions 4 December 4th 07 12:51 AM
code is not to work on sheet1 Allan R Jeffery New Users to Excel 3 August 22nd 06 02:22 PM


All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"