I recorded a macro to custom AutoFilter 2 columns in a worksheet. The information will be filtered between 2 dates; i.e. >= cell B2 and <= cell C2.
Both cells are formated to dd/mm/yy so i entered 1/12/06 (for 1st Dec) in cell B2 and 31/12/06 (for 31st Dec) in cell C2.
When i enter these 2 dates, click the button to run the macro and check the custom filter in the "Planning" worksheet it appears that the dates change to 12/01/06 and 21/12/06 and no records appear - although i know at least 65 rows should show.
If i then enter the dates in B2 and C2 as mm/dd/yy instead (but leave the date format of the cell as dd/mm/yy) the filter works perfectly; i.e. enter 12/01/06 and 12/31/06. However I plan to issue this spreadsheet out to other staff and as every other date in the spreadsheet is in the uk format dd/mm/yy i dont want to confuse them by insisting they use the mm/dd/yy format for this one function.
Has anyone ever encountered this before? and if so is there some way i can fix it?
Heres the code for the filter:
Sub Monthly_Stats()
Sheets("Planning").Select Selection.AutoFilter Field:=5, Criteria1:=">=" & Sheets("Filtered Statistics").Range("B2").Value, Operator:=xlAnd _ , Criteria2:="<=" & Sheets("Filtered Statistics").Range("C2").Value, Operator:=xlAnd Selection.AutoFilter Field:=82, Criteria1:="<>" End Sub
I want to pick a range of dates and find the number of days without sales between those dates. So, a formula that will look to a start date in A1 and an end date in B2, and then count the number of days that did not have sales between. Index/Match/Countif/Dateif I can't seem to make anything work.
There is a speadsheet at work with a column which has a range of dates (from 18/05/2003 - date) which information gets drawn from every Friday. The information needed from the column is pretty simple but lengthy to expalin. For example...
[url]
As you can the dates are in no order...and need to stay that way. The information needed every week is shown here...
[url]
I have got the formula for the number of enteries between each date but strugling with the earliest date within the dates. I can do it manually by auto filtering the column and looking for the date closest to the earliest date but this is long.
The dates change on a weekly basis...just to throw a spanner in the works.
does it not like dates? i have columns of data and i wish to search it for each month and then print a months worth. here is part of the data. maybe vlookup does not like dates? i tried putting an index column on the left, 1,2,3,4... but it still would not pick up "Jun"
Two macros have been developed in order to write entries to a sheet called Detention Register from another sheet named Database.
The first macro (AutofilterDatabase1) filters for two criteria in the Database sheet: 1. All dates 7 or more days prior to today's date (5th field called rDate) & 2. The smallest positive value for a person in field 10 (called rSmallest).
Once these filters have been applied a second macro (named WriteDetentionRegister) is supposed to write the filtered entries to a sheet called Detention Register. However, if no enties at all are found by the filter it writes all entries to the Detention Register. Is there any way of stopping the writing process if no entries at all are found after the filtering process?
I'd also prefer it if after the writing process (or not as the case may be) that all autofilters were returned to displaying 'All' data in the Database sheet for fields 5 and 10. Is this an easy tweak to make to the existing code?
I enclose the code of the 2 macros.
Sub AutoFilterDataBase1()
Application. ScreenUpdating = False
'Get today and convert to serial value, subtracting 7 days d = CLng(Date) - 7
= LOOKUP(BH23,B1:AF1) this is looking for a date (a returned value from another set of equations) in a row of other dates. I want a macro to use this lookup, find the date and then select it as an auto filter, with criteria? here is the macro and the part where it says auto filter is the part where I want it to do the above lookup function
Sub Brooke() ActiveWindow.ScrollWorkbookTabs Sheets:=-4 Sheets("Feb 03").Select Selection.AutoFilter Field:=28, Criteria1:="BH" Range("AD7:AD56").Select Selection.Copy Sheets("Brooke Hotel Running Order").Select ActiveSheet.Paste ActiveWindow.ScrollWorkbookTabs Position:=xlFirst Sheets("Feb 03").Select Range("AD62:AD68").Select Application.CutCopyMode = False Selection.Copy Sheets("Brooke Hotel Running Order").Select Range("B32").Select ActiveSheet.Paste ActiveWindow.ScrollWorkbookTabs Sheets:=-1 ActiveWindow.ScrollWorkbookTabs Sheets:=-1 Range("F23").Select End Sub
The 'Details' sheet has, among other data, the 'year' that the workbook refers to. From this, the beginning and end dates of each quarter appear in Cells F2:F10 in the 'Details' Sheet in the format dd/mm/yyyy.
In the 'Management' Sheet I have four buttons - Q1, Q2, Q3 and Q4. I want to attach code to apply a custom autofilter to each button so that clicking on one of the buttons will show only data from that quarter.
Using the macro recorder the following code is generated when applying a custom AutoFilter for Quarter One:
I have this script it does exactly as i want it to do, filter a table of date using two selected date in D3 and D4. There is only one problem: when i choose the dates and run the script it changes them around it around. e.g cell D3 = 01/11/2006 cell D4 = 01/12/2006 so it should just show all of november (11) but D3 will filter using 11/01/2006 and D4 will use 12/01/2006
I am encounting problems with an AutoFilter which is run in a macro after the user has selected dates from 2 Date Pickers (DTPicker) on a user form. The filter is applied to 1 column in a spreadsheet containing dates in the formay "dd/mm/yy" and is supposed to filter dates =2 and between a range of dates as selected. The resultant filter is blank, if the macro is debugged at this point the date format for the 1st criteria is found to have swopped the "dd" & "mm" around but the 2nd criteria is fine. eg. user selected 01/07/07 and 31/07/07 the resultant filter applied is 07/01/07 and 31/07/07. I have re-formatted dates to Long as per the article on this site @ http://www.ozgrid.com/VBA/autofilter-vba-dates.htm but still get the same result ???
Dim fDate, tDate As Date Dim lfDate, ltDate As Long fDate = frmReportMenu.dtpFromDate.Value tDate = frmReportMenu.dtpToDate.Value fDate = DateSerial(Year(fDate), Month(fDate), Day(fDate)) tDate = DateSerial(Year(tDate), Month(tDate), Day(tDate)) lfDate = fDate ltDate = tDate
The problem is that when I add dates via macros (like from a userform to a selected cell) to a cell in autofiltered column, the autofilter doesn't recognize these values as "proper" dates. If I activate the formula bar and press Enter, then the autofilter identifies the date properly.
This is how the autofilter popup looks like after I have added a date via my macro: [URL] ....
The new date doesn't get categorized by year and month, instead it just shows as text on a separate line (circled in red) (huhtikuu = April)
I have earlier used Formula:
[Code] ....
How I could get the autofilter working right with the inputed values? I have tried adding the date via .Value and .Formula but neither one works.
I have a column of dates: 1 day per row: 01/01/10, 02/01/10, 03/01/10, etc in sequence, without gaps (European date format). The list can begin with a different start date depending on initial user input and is not always a Monday. I want the user to be able to autofilter so that it only shows dates that fall on a Monday.
Private Sub Worksheet_Activate() Dim dDate As Date Dim strDate As String 'disable autofilter if already enabled With ActiveSheet .AutoFilterMode = False End With 'autofilter column a only, from a12, to filter Mondays If IsDate( Range("a12")) Then dDate = Range("a12") strDate = Weekday(dDate) Range("a12").AutoFilter Range("a12").AutoFilter field:=1, Criteria1:=strDate End If End Sub
Through VBA I am trying to filter for today's date and all dates 30 days in the future as well as all dates 30 days in the past.
I am currently using the code below, but it only show dates 30 days in the future. I cannot get it to populate cells that are either 30 days in the future or 30 days in the past.
-1st workbook, I am using a worksheet (let's call it workbook1/worksheet1) already running with macro. In this worksheet, there is a column "Protocol" where different protocols are named (some are repeated, not sorted)
-2nd workbook, there is a worksheet (call it workbook2/worksheet2) are just the list of description for each protocol listed in workbook1/worksheet1. For example: width, length, height
How do I get values found in workbook2/worksheet2 and use in workbook1/worksheet1 for each corresponding protocol?
If I have a date that is 12 February 2008 I need to pick up data next to 31 January 2008 as that is nearest, however if my date is >15th February 2008 I want to pick up the data in the column next to 29 February 2008......
When using a Pivot Table I regularly filter on known data specific to me i.e. WBS codes.
Column ‘A’ contains the WBS Codes which can be as many a 1000, however, I only need to filter out the 10 or so I require, and currently I uncheck all the records and manually scroll through the list to check the ones I require.
In order to speed things up I recorded a macro which works fine, however, If I need to check any new codes I would have to record the macro again, as I tried to edit the Macro and all it does is to un check all the other codes I don't need.
Is it possible to create a Macro that picks up a range of data that is then used to filter on. (i.e. only the records I require)
In the attached on the quote tab in cells G5 & H5 i have two formulas both trying to pick up the data from the highlighted matrix in the frame tab.(i only need one)
From the dropdowns in cells F1, F3 & F5 in the quote tab I wish to get the data from the matrix in the frame tab cell range C3 - F20
At the moment all our work is logged by codes eg. A1Misc, B5Change, N9Important. As well as the codes, we enter the date in the column next to the code along with another Column to show the amount.
I need a Macro to look at the date column and only take dates which have Sept then go to the column next to it and pick up the codes individually and sum up all the amounts for the codes.
I have attached an example which shows from A13 downwards what I need the macro to show when finished.
Where is that I have 2 sheets of data, sheet1 contains an ever expanding list of data and I'm trying to create a macro that deletes multiple rows of data from this sheet if the date held within column K is less than the date defined in sheet2.
I have a spreadsheet with my Periods along row 10. e.g. C10: "1", D10: "2", E10 "3", F10: "4", G10: "5" etc. (green on the attached sheet). I have my departments along column B, e.g. B11: "Baked" B12: "Fresh" B13: "Frozen" (yellow on the attached sheet)
what I need and cannot work out is some VBA code that will populate two variables (lets call them Period & Department) when I click on one of the figures. For example if I click on cell: if I click E14: Period would have the contents of cell E10, and Department the contents of cell B14.
if i click G14: Period would have the contents of G10, and Department the contents of cell B14 again. I know how to get the click on the cell to work properly etc, and I have code to slot these variables into that works very nicely, I just can't get this bit to work!!!!
I want to create a macro that will “open the look in list” and stop so I can pick a file to open. I’ve tried to use “record a macro” and “ctrl-o”, but the record a macro won’t stop until I pick a file or cancel the file list. I also tried to use “o” in the short cut key box
I have an Excel 2003 worksheet that has a list (Data > List > Create List), which displays the AutoFilters for each column in the list. I am seeking a macro that will filter the results (Custom > does not contain "Closed").
I would like to assign the macro to a button as the casual user might not understand the AutoFilter use.
The worksheet in VBE is defined as "Sheet3 (Audit Findings)" My list has headers on row 7 (A7:K7) I would like the AutoFilter to return all results except those marked as "Closed" in column K.
I am fighting a quixotic battle against a problem, that I realise may well be unsolvable. I have a worksheet that consists of approximately 27,000 rows in a four-level structure, like so:
1 1.1 1.1.1 1.1.1.1
To make the sheet easier to navigate I have created an expanding/collapsing tree structure by using simple hide and unhide rows, and on the last level of headings (1.1.1) I have cells that change between "+" and "-" depending on whether the fourth-level subset is currently visible or hidden. Naturally I need to keep the cell as "+" when the set is collapsed, and "-" when expanded. I have accounted for all methods user can change the hidden settings of those rows, but one:
When users autofilter the list, the +/- signs obviously screw up, because filtering resets the user-set hidden-settings. Suddenly I have expanded subsets with "-" on headings that were previously "+". Now this is obviously a vanity problem, as the +/- sign is not integral to the working of this macro, but the problem is that with three different levels of headers the worksheets starts to look a little cluttered.
Finally, my question: Is there any way to trigger a procedure to reset these signs upon/after autofilter? I realize that this is not a built-in Excel event, but a workaround will do just fine. Any way to detect that an autofiltering has taken place without having to check the.
I have a pivot table and and struggling to group these by month as well as to sort thee in escending order.
Pivot Table  ABC3Row LabelsSum of DebitSum of Credit 413/02/201334367.1822844.19513/03/201326475.492219.66613/08/201230307.613541.2713/09/2012 18898.0318065.4813/10/2012 7210.52913/11/201241969.041767.821013/12/201232844.7724041.26
My problem is following: I have a list of data that are classified according to a particular character, and I want to copy (with auto filter through the macro) the relevant information to the appropriate place in the sheet where it belongs. That's no problem. The problem is that if I want to copy data, classified by a character that is not listed in the table (that is not in the filtering criteria), then all the data are copied to the appropriate place. But I do not want to copy in this case nothing. How should such a macro look like?