Autofilter question

I have an autofilter with a column of data that includes operators such as > 
and <.

For example, one of the records would read "> 60 days past due"

How would I go about coding the criteria to show the records that display "> 
60 days past due"?

Thanks,
Chad
0
Utf
4/26/2010 8:23:01 PM
excel.programming 6508 articles. 2 followers. Follow

5 Replies
704 Views

Similar Articles

[PageSpeed] 37

Macro recorder returns this.

Selection.AutoFilter Field:=1, Criteria1:="=> 60 days past due"


Gord Dibben  MS Excel MVP


On Mon, 26 Apr 2010 13:23:01 -0700, Chad <Chad@discussions.microsoft.com>
wrote:

>I have an autofilter with a column of data that includes operators such as > 
>and <.
>
>For example, one of the records would read "> 60 days past due"
>
>How would I go about coding the criteria to show the records that display "> 
>60 days past due"?
>
>Thanks,
>Chad

0
Gord
4/26/2010 9:03:53 PM
Hi chad,

I am assuming that you tried recording this and while the filter worked in 
the interactive mode; when you run the code it does not work. The answer is 
to insert a leading equal sign.

"=>60 days past due"

A tip for these things is the following code. Set the filter then run the 
code and you will be able to see the criteria that needs to be used for the 
code.

Dim strCriteria

With Worksheets("Sheet1")
    If .AutoFilterMode Then
        With .AutoFilter.Filters(2)
            If .On Then strCriteria = .Criteria1
        End With
    End If
End With

MsgBox strCriteria


-- 
Regards,

OssieMac


"Chad" wrote:

> I have an autofilter with a column of data that includes operators such as > 
> and <.
> 
> For example, one of the records would read "> 60 days past due"
> 
> How would I go about coding the criteria to show the records that display "> 
> 60 days past due"?
> 
> Thanks,
> Chad
0
Utf
4/26/2010 9:30:01 PM
Ossie

When I record, Excel adds the appropriate  "=>60 days past due"


Gord

On Mon, 26 Apr 2010 14:30:01 -0700, OssieMac
<OssieMac@discussions.microsoft.com> wrote:

>Hi chad,
>
>I am assuming that you tried recording this and while the filter worked in 
>the interactive mode; when you run the code it does not work. The answer is 
>to insert a leading equal sign.
>
>"=>60 days past due"
>
>A tip for these things is the following code. Set the filter then run the 
>code and you will be able to see the criteria that needs to be used for the 
>code.
>
>Dim strCriteria
>
>With Worksheets("Sheet1")
>    If .AutoFilterMode Then
>        With .AutoFilter.Filters(2)
>            If .On Then strCriteria = .Criteria1
>        End With
>    End If
>End With
>
>MsgBox strCriteria

0
Gord
4/26/2010 10:24:15 PM
In Excel 2007 the macro recorder does not return the equal sign. The 
following is what I get with the macro recorder. I have not tested in any 
other versions.

ActiveSheet.Range("$A$1:$B$835").AutoFilter Field:=2, Criteria1:= _
        "> 60 days past due"

And of course the above does not work without the leading = sign when the 
code is run.

-- 
Regards,

OssieMac


"Gord Dibben" wrote:

> Macro recorder returns this.
> 
> Selection.AutoFilter Field:=1, Criteria1:="=> 60 days past due"
> 
> 
> Gord Dibben  MS Excel MVP
> 
> 
> On Mon, 26 Apr 2010 13:23:01 -0700, Chad <Chad@discussions.microsoft.com>
> wrote:
> 
> >I have an autofilter with a column of data that includes operators such as > 
> >and <.
> >
> >For example, one of the records would read "> 60 days past due"
> >
> >How would I go about coding the criteria to show the records that display "> 
> >60 days past due"?
> >
> >Thanks,
> >Chad
> 
> .
> 
0
Utf
4/26/2010 10:43:02 PM
My testing was on 2003.

I have since tested on 2007 and found that you get different results
depending upon how you filter.

Selecting from the list you get

ActiveSheet.Range("$A$1:$A$22").AutoFilter Field:=1, Criteria1:=">60 days"

Selecting from Custom>Equals you get

ActiveSheet.Range("$A$1:$A$22").AutoFilter Field:=1, Criteria1:="=>60 days" 

2003 treats both methods the same and returns in both cases

ActiveSheet.Range("$A$1:$A$22").AutoFilter Field:=1, Criteria1:="=>60 days" 



Gord

On Mon, 26 Apr 2010 15:43:02 -0700, OssieMac
<OssieMac@discussions.microsoft.com> wrote:

>In Excel 2007 the macro recorder does not return the equal sign. The 
>following is what I get with the macro recorder. I have not tested in any 
>other versions.
>
>ActiveSheet.Range("$A$1:$B$835").AutoFilter Field:=2, Criteria1:= _
>        "> 60 days past due"
>
>And of course the above does not work without the leading = sign when the 
>code is run.

0
Gord
4/27/2010 3:18:44 PM
Reply:

Similar Artilces:

Excel 2002
....I have a large amount of amount to produce multiple charts from, so using Autofilter is a bit of a necessity. Using the Chart Wizard, I can easily select the filtered data range but it doesn't seem possible to select the (filtered) headings as the X-axis (time period). Any ideas or workrounds? Thanks in advance, Amanda when you set up your autofilter range leave the row you want to use for your axis out of the range. "Birmangirl" wrote: > ...I have a large amount of amount to produce multiple charts from, so using > Autofilter is a bit of a necessity. Using the...

Another Access Question
Hi Everyone, Is it possible to place the front end (forms) of an Access Databse on a web page, so that users can log on via the net and enter data into the forms. I am guessing that the front end would have to stand alone but not sure ! Any advice would be great Thanks will07 <will07@discussions.microsoft.com> wrote: >Is it possible to place the front end (forms) of an Access Databse on a web >page, so that users can log on via the net and enter data into the forms. I >am guessing that the front end would have to stand alone but not sure ! Can't be done using...

look up question #2
I have a list of people with their system rights in the next column by group. Each person may have more than one type of right in the list as follows John Smith Edit Joe Doe Submit Cathy Dory Edit John Smith Submit As you can see above, John Smith has both edit and submit rights on this list. What I am looking for is a formula where I can look down the list of names and find all instances of John Smith and then it can tell me if John Smith ever has edit rights or ever has submit rights. What I would like it to do is return a 1 if he has edit rights a...

Yet another Lotus macro question
I have for the most part converted to Excel but have a simple macro that on the surface cannot be converted. The Lotus macro used a database, template and list of branch names. The macro itself started with the name of the first branch, copied it to the template, sucked in the data for that branch and then printed the report. Then it went down to next name on the list and repeated the process until it reached the bottom of the list. In Excel it seems to indicate I have to repeat the steps for each and every branch on the list and not loop back through a 8 line macro that refers to the ...

question about spam
How is it that spam sent to one mailbox will end up in another not mentioned in the "to" address. In other words how is it that spammers get mail destined to Bob in Jim's mailbox? In news:y9CIg.1194$Cq4.62@newssvr25.news.prodigy.net, Mostro <ovelozpleasenospammingme@glasnospampleasefloss.com> typed: > How is it that spam sent to one mailbox will end up in another not > mentioned in the "to" address. In other words how is it that > spammers get mail destined to Bob in Jim's mailbox? The BCC field. It can be used for evil as well as good. ...

NMHDR question about hwndFrom
the documentation says that the hwndFrom attribute is the window handle to the control sending a message. I have a toolbar sitting on a property page. the toolbar is sending the message. Am I correct in assuming that the hwndFrom is the property page? I am having a problem obtaining the window handle of the property page. From the toolbar, I am calling CWnd* pOwner = GetOwner(); fh.hwndFrom = pWnd->GetSafeHwnd(); When I run the debugger pOwner correctly has the value CMyNotesPP, which is the parent window. When I step through the next line hwndFrom has a value in it but when I click th...

CDC::GetTextExtent question
Hi, I have a function that is to resize a status bar text pane when setting text dynamically. GetTextExtent() seems to think the text is almost twice as wide as it actually is so it leaves too much white space. How come? This is my func.: BOOL CMainFrame::SetStatusText(UINT nID, LPCTSTR lpszText) { int index = m_wndStatusBar.CommandToIndex(nID); if (index < 0) return FALSE; UINT nIDRet, nStyle; int cxWidth; m_wndStatusBar.GetPaneInfo(index, nIDRet, nStyle, cxWidth); ASSERT( nID == nIDRet ); CSize sz(cxWidth, 0); CDC* pDC = m_wndStatusBar.GetDC(); if (pDC) { sz = pDC->...

Datasheet question
Is it possible to show a Form Header on a Datasheet form ? Thanks Not that I know of, but you could emulate it by creating a new form with a form header (unbound - no rowsource) and place a subform in that form displayed as datasheetview. Maurice "Phil Hunt" wrote: > Is it possible to show a Form Header on a Datasheet form ? > > Thanks > > > No but you can fake it by putting the datasheet form in a subform = control on an unbound main form - Put whatever you'd like on the main = form. --=20 Joan Wild Microsoft Access MVP "Phil Hunt" &l...

newbie question on multi-dimensional array
Hi all, I have a real lame question about multi-dimensional array operation. Suppose I have defined a two-dimensional array "Array(10,10)". If I want to use the Excel function "Average" to compute the average value of Column, say 10, of that 2D array, is there any way to realize it? I tried "Application.Average(Array(:,10))", but apparently the Excel doesn't like that. (You can see I am a Matlab guy, so please don't laugh at me:) ) Any comments are extremely welcome. -- sammus ------------------------------------------------------------------------...

Microsoft Outlook 2003 tasks view question
In Microsoft Outlook 2003, I am able to define a customized view of each column, under the Tasks section. Is it possible to share the same customized view of the Tasks with other users? In other words, when other users open a shared view of a Task, I want them to see the same column structure as I see. If it is possible to propagate or share my defined view of columns, can someone describe the procedure? Thanks kindly. Joseph There is not an easy "copy this to everyone" command but its possible. When you create the view, use the option to share it with everyone. When they vie...

A few small questions
I have an Excel document with many tab (actually it look like a database, before any other thing no I can't move it to Access (corporate reasons). I also have a restriction to avoid using macro!!!! First is there a way for footer or header information to include info from cells in the speadsheet. Second you can define info to repeate at the top, what about at the bottom of the page. Third the sheet that serve for report can have up to 8 pages, can the printing zone be define by a cell value, so that page x of y (the y part be other than 8). I have the database part in a sheet bu...

formula question #7
Is there a formula that can change the color of cells if revenues drop three months in a row and if so what should the formula be? Hi, Assuming that your data is in row 1, columns A,B,C, with C being the latest data, Try using conditional formatting in cell C1 with the "Formula Is" =IF(AND(C1<B1,B1<A1),1,0) HTH >-----Original Message----- >Is there a formula that can change the color of cells if >revenues drop three months in a row and if so what should >the formula be? >. > Formula only needs =AND(D1<C1,C1<B1,B1<A1) you don't need t...

Layout Question Please
Outlook 2003 When I am in the Monthly calendar view I have three small month calendars in the left hand pane which is fine. If I click the folders button on the left, the folders pane shows on the left with the full calendar view on the right which is how I want it. The problem is that in the left pane on top of the folder list it still shows on of those small calendars which takes up room from my folder list and I cannot see all of the folders. How do I configure it so the left pane is all the folder list and does not include the small calendar? Thanks in advance... Bob I don't th...

Question on "Value" function
In trying to use Excel to help solve a mathematical puzzle, I would like to calculate the result of applying the mathematical operator in one cell to the numbers in two other cells. Example: A1 contains 2, B1 contains +, C1 contains 3. In D1, create a formula that will give the result of 2 + 3, i.e. 5. I have tried (among many other attempts) =VALUE(CONCATENATE(A1, B1, C1)), but it gives me a #VALUE! error. What am I missing? Hi this is not possible without using VBA. try the following UDF: Public Function my_calculate(op1 As Range, operand As Range, op2 As Range) my_calculate = Ap...

xml question?
what is the equivalent of this in C# ? foreach (XmlNode xmlConfigNode in xmlConfigDoc["configuration"].ChildNodes) Thansk Sorry I made a mistake here is what I want to convert to C# For Each Node In XmlDocument.Item("configuration").Item("appSettings") "Ray5531" <Ray5531@microsoft.com> wrote in message news:elPIiezOFHA.3408@TK2MSFTNGP14.phx.gbl... > what is the equivalent of this in C# ? > > foreach (XmlNode xmlConfigNode in > xmlConfigDoc["configuration"].ChildNodes) > > > > Thansk > > Hi Ray,...

Back Order Question
Hi, Have a back order question. Normal back orders are working right. In that if you have 10 and the order is for 15. During the lineitem transtaction it will put 5 in the backorder field automatically. What we need is if the customer orders 15 and we have 20, but only ship 10. We want the BO field to automatically fill with 5. Is this possible. Thanks in advance. Dexter Southerland It depends on how you fulfill and if you have cancel and bo enabled in the document types. If you have these enabled and are using Use Separate Fulfillment, you can select 10 to ship and set 5 to BO. T...

Dynamics GP 10 Reporting Question
I heard reporting in GP 10 is upgraded. Does anyone know if it will be anything like Rockton Software Dynamics Report Manager where you can send any report to like Sql reporting services or crystal? ------=_NextPart_0001_70733CB7 Content-Type: text/plain Content-Transfer-Encoding: 7bit I haven't heard anything at all that reporting in 10.0 will be changed. While I guess it's possible, I would assume for now that there won't be any big changes in general. I would expect more MS Office & SQL integration in the next version for sure, but I can't see everything rewrit...

copying between cols using autofilter
Hi, I am relatively inexperienced with Excel 2k autofilter option. I have a very large worksheet, with approx 20k number of rows, and 8 cols. I am interested in 2 cols which are adjacent to each other on the worksheet. The first col has data (text only), the 2nd col has a certain no. of blank fields. It is the blank cells that I am interested in. I use the auto filter option and using the pull-down list on the 2nd col select and select only the blank cells. I now wish to copy the contents of the the first col to the 2nd col, where there are blank fields, so in effect renaming that cell with ...

Array range error question
When i try to redim my array i get an out of range error. can someone tel me why? Cells A1..A10 are filled with strings. thanks much Sub Get_names_array() Dim names_array() As Variant 'dynmanic Dim j As Long ReDim names_array(5, 1) j = 0 Range("A1").Select For i = 1 To 10 names_array(j, 0) = ActiveCell.Value names_array(j, 1) = ActiveCell.Address arraylimitFirst = UBound(names_array, 1) 'returns current dimension of 1st array limit, init = 5 If j >= arraylimitFirst Then ReDim Preserve names_array(10, 1) ' << RANGE ERROR ...

Newbie Remote Assistant and Desktop Questions
i Folks: Developing C++ on VS 2008 Pro, XP Pro, Win32. I have a client that recently upgraded from Vista to Windows 7 Ultimate, 32 bit, on his laptop. I recommended he get Ultimate so I could run Remote Desktop over the Internet. This is before I actually tried using Remote Desktop. After getting Remote Desktop up, I see that I really want, to help my client, is Remote Assistant. Both Remote Desktop and Remote Assistant are now running fine with two XP PCs on my LAN, using my Internet address, to connect. I've cobbled together port numbers requiring...

Just a quick question
I want to be able to average a range of cells, some of these cells are 0, and those are the ones I don't to include in on the calculation. Brian, If your data is in "B5:D14"... =SUM(B5:D14)/COUNTIF(B5:D14,">0") Regards, Jim Cone San Francisco, CA "Brian Shafer" <brian.shafer123@insightbb.com> wrote in message news:u5UCb.386665$275.1243012@attbi_s53... > I want to be able to average a range of cells, some of these cells are 0, > and those are the ones I don't to include in on the calculation. > > Brian, If your range actually...

=CELL("filename") function related question
Is there a function in Excel that only picks up the sheet name in a workbook? I realised that =CELL("filename") function provides the full path, workbook & the worksheet information. Thanks in advance for any help & suggestions. Take a look here: http://www.mcgimpsey.com/excel/formulae/cell_function.html In article <1105122023.529944.145500@z14g2000cwz.googlegroups.com>, "wfcpyc" <wfcpyc@yahoo.com.au> wrote: > Is there a function in Excel that only picks up the sheet name in a > workbook? I realised that =CELL("filename") fun...

Licensing Questions
I'm building an iSCSI host for a client of mine, and was wondering what the license requirements would be. Here is he question, If I install my iSCSI host software (in this case StarWind) on a windows 2003 Platform, what kind of license do I need, ie do I only need the OS license or do I also need CLIs. Since no actual "User" will be accessing this Server Directly (they might be using a VMDK stored on the host LUN, but that would be via my VMware servers... basiclly, I'm using the iSCSI host, to host disk space for 2 or 3 VMWare ESXi hosts, hosting 2 or 3 VMs which...

GP Report Modifier Question (version 9.0)
On our invoice report I changed the format of a custom field to a custom format definition (that I named BB2 with 2 decimal places and show the currency symbol). Now our Inventory History Sales Summary Report prints all of the Total Quantities for the item with a currency symbol also, why is that? Is your Inventory History Sales Summary Report modified? Have you opened the field to check and make sure no format has been assigned to it? ...

Disaster Recovery Question!
I'm sort of new at this. I have 1 server running 2003 as DC/DNS/DHCP and I have another server running Exchange 2003. I want to create an off site disaster recover network. I know I can create the connection with a VPN. I know I can do a backup DC and a secondary DNS. My questions is can I create a backup Exchange 2003 Server? Is this possible? I know DC/DNS are small enough that it can easily be updated on the secondary server. How do you guys set up a secondary Exchange 2003 server? I hope you guys can give me an answer. Thanks! Phil If you mean real-time replication ...