PC Review


Reply
Thread Tools Rate Thread

how to create macro to use cell references for data filter criteri

 
 
=?Utf-8?B?c2NzaG9w?=
Guest
Posts: n/a
 
      22nd Jun 2007
I have a large series of data where the criteria for the data filter updates
a linked chart. The data looks as follows:

Time Stamp Data1 Data2 Data3 Data4
6/21/07 10:05AM 123 124 125 126
6/21/07 10:10AM 223 224 225 226
6/21/07 10:15AM 323 324 325 326
etc.

I use the data filter to select the criteria that is greater than or equal
to first specified date & time and is less than or equal to second specified
date & time. Because the chart is on a different sheet and there are other
input fields that are also required for the chart, I’m trying to automate as
much of the charting as possible.

I have two cells where I would input the start and end dates. How do you
create a macro that will take the start date as the first criteria in the
data filter and the end date as the second criteria? The start and end dates
will vary. When I’ve tried to create the macro, it will take the input start
date as the actual date, meaning, if I change the start date, I will still
get the original start date. Is there any way to use whatever I type in for
the start and end dates for the data filter criteria?

On a similar topic, since the chart updates to the parameters of the data
filter, the y-axis scale becomes skewed. I’ve created a formula to calculate
the min and max for the scale. Again the macro I’ve tried to create only
recognizes the actual value in the cell rather than the formula output. How
would I create a macro to recognize the result of the formula?

Thank you in advance.

 
Reply With Quote
 
 
 
 
Debra Dalgleish
Guest
Posts: n/a
 
      23rd Jun 2007
You could create a criteria range, with two columns with the same
heading as the date field in the data table. Use formulas to pull the
dates from the start and end date cells, e.g.:

Date Date
=">=" & StartDate ="<=" &EndDate

Use this criteria range when you run the Advanced Filter.

scshop wrote:
> I have a large series of data where the criteria for the data filter updates
> a linked chart. The data looks as follows:
>
> Time Stamp Data1 Data2 Data3 Data4
> 6/21/07 10:05AM 123 124 125 126
> 6/21/07 10:10AM 223 224 225 226
> 6/21/07 10:15AM 323 324 325 326
> etc.
>
> I use the data filter to select the criteria that is greater than or equal
> to first specified date & time and is less than or equal to second specified
> date & time. Because the chart is on a different sheet and there are other
> input fields that are also required for the chart, I’m trying to automate as
> much of the charting as possible.
>
> I have two cells where I would input the start and end dates. How do you
> create a macro that will take the start date as the first criteria in the
> data filter and the end date as the second criteria? The start and end dates
> will vary. When I’ve tried to create the macro, it will take the input start
> date as the actual date, meaning, if I change the start date, I will still
> get the original start date. Is there any way to use whatever I type in for
> the start and end dates for the data filter criteria?
>
> On a similar topic, since the chart updates to the parameters of the data
> filter, the y-axis scale becomes skewed. I’ve created a formula to calculate
> the min and max for the scale. Again the macro I’ve tried to create only
> recognizes the actual value in the cell rather than the formula output. How
> would I create a macro to recognize the result of the formula?
>
> Thank you in advance.
>



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

 
Reply With Quote
 
=?Utf-8?B?c2NzaG9w?=
Guest
Posts: n/a
 
      27th Jun 2007
hi debra,

thanks for your response. i don't quite understand (i'm a bit of a macro
novice). the data is stored in excel. in a different workbook, i have in
two columns and rows:

A B
1 start date end date
2 [input date] [input date]

now i want to create a macro that recognizes the date i input for start date
as the "greater than or equal to" criteria in the autofilter, and the date i
input for end date as the "less than or equal to" criteria in the autofilter.
the input dates will vary.

so should i record a macro using the input dates and then use VB to modify
the criteria to =">=" & StartDate ="<=" &EndDate?

does this work for scaling the chart to your min and max ranges?

thanks for your help!!

"Debra Dalgleish" wrote:

> You could create a criteria range, with two columns with the same
> heading as the date field in the data table. Use formulas to pull the
> dates from the start and end date cells, e.g.:
>
> Date Date
> =">=" & StartDate ="<=" &EndDate
>
> Use this criteria range when you run the Advanced Filter.
>
> scshop wrote:
> > I have a large series of data where the criteria for the data filter updates
> > a linked chart. The data looks as follows:
> >
> > Time Stamp Data1 Data2 Data3 Data4
> > 6/21/07 10:05AM 123 124 125 126
> > 6/21/07 10:10AM 223 224 225 226
> > 6/21/07 10:15AM 323 324 325 326
> > etc.
> >
> > I use the data filter to select the criteria that is greater than or equal
> > to first specified date & time and is less than or equal to second specified
> > date & time. Because the chart is on a different sheet and there are other
> > input fields that are also required for the chart, I’m trying to automate as
> > much of the charting as possible.
> >
> > I have two cells where I would input the start and end dates. How do you
> > create a macro that will take the start date as the first criteria in the
> > data filter and the end date as the second criteria? The start and end dates
> > will vary. When I’ve tried to create the macro, it will take the input start
> > date as the actual date, meaning, if I change the start date, I will still
> > get the original start date. Is there any way to use whatever I type in for
> > the start and end dates for the data filter criteria?
> >
> > On a similar topic, since the chart updates to the parameters of the data
> > filter, the y-axis scale becomes skewed. I’ve created a formula to calculate
> > the min and max for the scale. Again the macro I’ve tried to create only
> > recognizes the actual value in the cell rather than the formula output. How
> > would I create a macro to recognize the result of the formula?
> >
> > Thank you in advance.
> >

>
>
> --
> Debra Dalgleish
> Contextures
> http://www.contextures.com/tiptech.html
>
>

 
Reply With Quote
 
=?Utf-8?B?c2NzaG9w?=
Guest
Posts: n/a
 
      4th Jul 2007
aha! i got it now. thank you!


"Debra Dalgleish" wrote:

> You could create a criteria range, with two columns with the same
> heading as the date field in the data table. Use formulas to pull the
> dates from the start and end date cells, e.g.:
>
> Date Date
> =">=" & StartDate ="<=" &EndDate
>
> Use this criteria range when you run the Advanced Filter.
>
> scshop wrote:
> > I have a large series of data where the criteria for the data filter updates
> > a linked chart. The data looks as follows:
> >
> > Time Stamp Data1 Data2 Data3 Data4
> > 6/21/07 10:05AM 123 124 125 126
> > 6/21/07 10:10AM 223 224 225 226
> > 6/21/07 10:15AM 323 324 325 326
> > etc.
> >
> > I use the data filter to select the criteria that is greater than or equal
> > to first specified date & time and is less than or equal to second specified
> > date & time. Because the chart is on a different sheet and there are other
> > input fields that are also required for the chart, I’m trying to automate as
> > much of the charting as possible.
> >
> > I have two cells where I would input the start and end dates. How do you
> > create a macro that will take the start date as the first criteria in the
> > data filter and the end date as the second criteria? The start and end dates
> > will vary. When I’ve tried to create the macro, it will take the input start
> > date as the actual date, meaning, if I change the start date, I will still
> > get the original start date. Is there any way to use whatever I type in for
> > the start and end dates for the data filter criteria?
> >
> > On a similar topic, since the chart updates to the parameters of the data
> > filter, the y-axis scale becomes skewed. I’ve created a formula to calculate
> > the min and max for the scale. Again the macro I’ve tried to create only
> > recognizes the actual value in the cell rather than the formula output. How
> > would I create a macro to recognize the result of the formula?
> >
> > Thank you in advance.
> >

>
>
> --
> Debra Dalgleish
> Contextures
> http://www.contextures.com/tiptech.html
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
data filter criteria based on cell references? =?Utf-8?B?c2NzaG9w?= Microsoft Excel Worksheet Functions 1 22nd Jun 2007 03:16 AM
Re: how to create a macro that references the currently active cell Bob Phillips Microsoft Excel Worksheet Functions 0 13th Dec 2006 05:42 PM
Need macro to filter, create tab on filter and copy/paste Jen Microsoft Excel Programming 1 2nd May 2006 04:45 PM
Macro to create a Outlook Appointment from excel cell data =?Utf-8?B?QWxhcm1ibG9rZQ==?= Microsoft Excel Programming 1 27th Jan 2006 03:49 PM
create a macro to copy/paste cell data joshua.v Microsoft Excel Programming 1 14th Sep 2004 04:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:30 AM.