Wednesday, July 6, 2016

Troubleshooting:Autofilter select dates Excel 2003

Autofilter select dates Excel 2003

I use the following line of programming to create/initialise a listbox in a userform showing the last 12 calendar months
For x = 0 To 11
lstselectyedcalendarmonth.AddItem Format(DateAdd("m", -x, Date), "mmmm yyyy")
Next
End Sub

I would like to use the selected month as a filter to show the number of transactions in that particular selected month I already have a further selection process which will extract details between two specific dates using the following code

.Range("a1").CurrentRegion.AutoFilter Field:=8, Criteria1:=">=" & Format(CDate(Me.txtstartdate.Value), "mm/dd/yyyy"), Operator:=xlAnd, criteria2:="<=" & Format(CDate(Me.txtenddate.Value), "mm/dd/yyyy")

I cannot however get this autofilter to select on month only presumably the value of the selected item will be lstselectedcalendarmonth.value but I cannot format the date or get the filter to work correctly

Can anyone point me in the right direction

Thanks
Brian
Scotland

Anwsers to the Problem Autofilter select dates Excel 2003

Download Error Fixer for Free Now

Sorry if I did not explained myself clearly!
The filter function can not filter for a selected month and year as you are trying to do.
You have to filter for a time interval, i this case between first and last day of the selected month and year.
The items in your ListBox are not true dates, but a text string containing a year and a month name.
To build a true start and end date, I extracted the year from the text string, and then I used the loop to compare the selected month and find the month number.
With this information, I am able to create true dates.
In my example I did not used your ListBox name, I rather used me.Listbox1.
Using your ListBox name, the code should look like this:
Dim MyYear As Long
Dim m As Long
MyYear = Mid(lstselectyedcalendarmonth, WorksheetFunction.Find(" ", lstselectyedcalendarmonth) + 1)
For m = 1 To 12
        If Left(lstselectyedcalendarmonth, WorksheetFunction.Find(" ", lstselectyedcalendarmonth) - 1) = _
               Format(DateSerial(2010, m, 1), "mmmm") Then
        Exit For
    End If
Next
StartDate = DateSerial(MyYear, m, 1)
enddate = DateSerial(MyYear, m + 1, 1) - 1
.Range("a1").CurrentRegion.AutoFilter Field:=8, Criteria1:=">=" _
    & Format(StartDate, "mm-dd-yyyy"), Operator:=xlAnd, _
    Criteria2:="<=" & Format(enddate, "mm-dd-yyyy")
Regards,
Per

Open Action Center by clicking the Start button Picture of the Start button, clicking Control Panel, and then, under System and Security, clicking Review your computer's status.

Update and run your antivirus software. Windows doesn't come with antivirus software, but Action Center can often monitor the antivirus software that you or your computer manufacturer have installed.

Another Safe way to Repair the Problem: Autofilter select dates Excel 2003:

How to Fix Autofilter select dates Excel 2003 with SmartPCFixer?

1. You can Download SmartPCFixer here. Install it on your system. When you open it, it will perform a scan.

2. After the scan is finished, you can see the errors and problems which need to be fixed.

3. The Fixing part is finished, the speed of your computer will be much higher than before and the errors have been removed.


Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: Solution to Problem: Arrow cursor on desktop screen,Automatic Copy of Text from 1 cell on 1 sheet to another cell on another sheet within a workbook Tech Support,Troubleshoot:Are there any free start screen backgrounds for Windows 8 available?,Fast Solution to Problem: Auto Date for 01\/month\/year, for Any date of a Month,Troubleshooting:Avery Wizard business card,application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?

No comments:

Post a Comment