Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Opening the Autofilter dialog box

I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Opening the Autofilter dialog box

is this just illustrative or are firstdate and seconddate actually string
variables containing the date in the correct format. If the latter

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & firstdate, _
Operator:=xlAnd, Criteria2:="<=" & seconddate

--
Regards,
Tom Ogilvy




"Pops Jackson" wrote:

I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Opening the Autofilter dialog box

I think the problem is in the use of variables - you have specified
literal text, so the filter is happening on the TEXT - try something
like

dim StartDate as string, secondDate as string
StartDate="="& format(whateverdate,whateverformat)
Selection.AutoFilter Field:=1, Criteria1:=StartDate
etc



Pops Jackson wrote:
I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Opening the Autofilter dialog box

Tom, you always come through. This works perfectly. The first column
contains trade dates, with numerous trades on a particular date. The routine
being developed will copy the selected range (in the date column and in
specific other columns) and paste it all in another workbook which has
formulae and macros for analysis of the data. I had everything else working
fine for a specific date but was informed that a date range was required.
Your suggested correction has helped me get it done.

Thanks,

Jim
--
Pops Jackson


"Tom Ogilvy" wrote:

is this just illustrative or are firstdate and seconddate actually string
variables containing the date in the correct format. If the latter

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & firstdate, _
Operator:=xlAnd, Criteria2:="<=" & seconddate

--
Regards,
Tom Ogilvy




"Pops Jackson" wrote:

I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Opening the Autofilter dialog box

Pops jackson -
Great, glad it worked!

--
Regards,
Tom Ogilvy


"Pops Jackson" wrote:

Tom, you always come through. This works perfectly. The first column
contains trade dates, with numerous trades on a particular date. The routine
being developed will copy the selected range (in the date column and in
specific other columns) and paste it all in another workbook which has
formulae and macros for analysis of the data. I had everything else working
fine for a specific date but was informed that a date range was required.
Your suggested correction has helped me get it done.

Thanks,

Jim
--
Pops Jackson


"Tom Ogilvy" wrote:

is this just illustrative or are firstdate and seconddate actually string
variables containing the date in the correct format. If the latter

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & firstdate, _
Operator:=xlAnd, Criteria2:="<=" & seconddate

--
Regards,
Tom Ogilvy




"Pops Jackson" wrote:

I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Opening the Autofilter dialog box

Thanks, Aidan.

Your suggestion also gives me the needed help. To you and Tom, thank you
very much for the quick responses. By the time I actually post a question, I
have tried everything I can think of and have combed the existing posts to
find one that already has addressed my problem. So I am at the "desperate"
level when I post and quick responses are invaluable.

Thanks again,

Jim
--
Pops Jackson


" wrote:

I think the problem is in the use of variables - you have specified
literal text, so the filter is happening on the TEXT - try something
like

dim StartDate as string, secondDate as string
StartDate="="& format(whateverdate,whateverformat)
Selection.AutoFilter Field:=1, Criteria1:=StartDate
etc



Pops Jackson wrote:
I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Opening the Autofilter dialog box

You could do it without filtering if you are copying cells by code, by
checking the date in the cell against the bounds, and only if they
match copying them over - I'd do it with OFFSET and a counter variable
as sometimes on our machines the lastcell doesn't return the last cell
(or just refuses to work at all!) - but as long as you have a working
solution, our job is done!




Pops Jackson wrote:
Thanks, Aidan.

Your suggestion also gives me the needed help. To you and Tom, thank you
very much for the quick responses. By the time I actually post a question, I
have tried everything I can think of and have combed the existing posts to
find one that already has addressed my problem. So I am at the "desperate"
level when I post and quick responses are invaluable.

Thanks again,

Jim
--
Pops Jackson


" wrote:

I think the problem is in the use of variables - you have specified
literal text, so the filter is happening on the TEXT - try something
like

dim StartDate as string, secondDate as string
StartDate="="& format(whateverdate,whateverformat)
Selection.AutoFilter Field:=1, Criteria1:=StartDate
etc



Pops Jackson wrote:
I have gotten frustrated with trying to get my code to work autofiltering
date ranges.
The code I am using includes:
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=firstdate",
Operator:=xlAnd, Criteria2:="<=seconddate"

The result is that the entire range is hidden.

How can I get the default autofilter dialog to show? I have decided this is
the best solution unless the code I am using can be altered successfully.

Thanks,

Jim
--
Pops Jackson




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
autofilter dialog boxes - can i call this up in the Mr BT Excel Worksheet Functions 3 January 15th 09 09:23 PM
Dialog box upon opening workbook Anthony[_5_] Excel Worksheet Functions 13 January 7th 09 04:51 AM
Opening Built-In Custom AutoFilter Dialog Box Programmatically [email protected] Excel Programming 2 May 23rd 06 09:37 AM
Opening a dialog Fredrik Wahlgren Excel Programming 3 February 2nd 05 12:54 AM
AutoFilter Custom Dialog AlexJ Excel Programming 1 February 27th 04 01:12 PM


All times are GMT +1. The time now is 08:53 AM.

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

About Us

"It's about Microsoft Excel"