I don't understand what you're asking. Your sheet has a column of date/time values. in VBA you can convert this to an integer to get the date, a Double to get the date and fraction of a day or you can use Datevalue() and timevalue() The terms you use: "Appy date filters" that has specific meaning with regard to Excel worksheets, but is NOT very specific with regard to VBA. and.. "for previous date" ?? previous to WHAT? today? the previous row?
as for formats: When I opened the workbook, all of the values looked to be in the same format: m/d/yyyy h:ss But that may be due to my own regional and Excel settings. the fact is: Excel stores this date/time as a NUMBER 7/10/2014 10:31 is 41830.438646 how this number is DISPLAYED depends on your settings in Windows and Excel. Your Windows Regional settings may say dates are displayed as dd-mm-yyyy or mm-dd-yyyy So when YOU open the file, Excel displays the number in the format you've defined. If you let us know what it is you're trying to do, we'd be glad to help. But if you insist on saying you want to "apply date filters", then about the only solution you'll get that uses these terms is to use Excel AutoFilters and then look through the sheet and test to see if the cell is visible. which is probably not what you're looking for. Paul ----------------------------------------- “Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.” - John Wesley ----------------------------------------- From: Nitin Balodi <nitinbal...@live.com> >To: "excel-macros@googlegroups.com" <excel-macros@googlegroups.com> >Sent: Friday, September 26, 2014 8:11 AM >Subject: $$Excel-Macros$$ Applying Date Filters using VBA > > > > >Hi experts, > > >I want to apply date filter in the attached sheet for previous date using VBA. >Could you please guide me how to apply date filters as I am struggling to >apply these especially with their formats and declaration while writing code. > > >I mean sometimes I have to declare them as Date datatype and sometimes as >string and sometimes I have to Format them according to my requirement. Is >there any generic datatype for date that works for any format. > > > >Regards. > > >Yours Sincerely, >Nitin Balodi -- >Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s >=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ >https://www.facebook.com/discussexcel > >FORUM RULES > >1) Use concise, accurate thread titles. Poor thread titles, like Please Help, >Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get >quick attention or may not be answered. >2) Don't post a question in the thread of another member. >3) Don't post questions regarding breaking or bypassing any security measure. >4) Acknowledge the responses you receive, good or bad. >5) Jobs posting is not allowed. >6) Sharing copyrighted material and their links is not allowed. > >NOTE : Don't ever post confidential data in a workbook. Forum owners and >members are not responsible for any loss. >--- >You received this message because you are subscribed to the Google Groups "MS >EXCEL AND VBA MACROS" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to excel-macros+unsubscr...@googlegroups.com. >To post to this group, send email to excel-macros@googlegroups.com. >Visit this group at http://groups.google.com/group/excel-macros. >For more options, visit https://groups.google.com/d/optout. > > > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.