PDA

View Full Version : [SOLVED] Filter On Date With Headers



jevi
09-02-2017, 01:52 PM
Awkward ain't it? Try:Sub blah()
x = CLng(Date)
ActiveSheet.UsedRange.AutoFilter Field:=2, Criteria1:=">=" & x, Operator:=xlAnd, Criteria2:="<" & x + 1
End Sub


I need help please....this today date filter is really tricky. Your VBA it works great but it doesn't filter with header I need also headers....thank you

SamT
09-02-2017, 02:20 PM
Question moved from old thread: http://www.vbaexpress.com/forum/showthread.php?46703-VBA-to-autofilter-on-current-date

jevi
09-02-2017, 02:22 PM
Just found the solutuion still thank u P45CAL for your code.

Sub Ufa()
Dim LastRrow As Long
LastRrow = Attuale.Range("A" & Rows.Count).End(xlUp).Row
x = CLng(Date)
ActiveSheet.Range("A9:J" & LastRrow).AutoFilter Field:=9, Criteria1:=">=" & x, Operator:=xlAnd, Criteria2:="<" & x + 1
End Sub

jevi
09-02-2017, 02:33 PM
Thank you Sam...sorry if I used an old thread....

SamT
09-02-2017, 06:21 PM
It's OK.

In fact, old threads have been under discussion by the Moderators for a while now. We are all trying to figure out the best way to handle them for members.

What do you think?

jevi
09-03-2017, 02:24 AM
Thank you, yeah in fact is not an easy issue, becase for me I searched it and it was what I was looking for so I didn't thought of a new thread ...but yeah when it is so old it should be a new thread I think. The problem was that I wanted to give credit to P45CAL for the code and not put it as a new thread as a code of mine...:)...but also to get the attention on that topic because as it was the code of P45CAL he would easly know the answer of my question and I thought I would have more possibilities of getting an asnwer :):).


It's OK.

In fact, old threads have been under discussion by the Moderators for a while now. We are all trying to figure out the best way to handle them for members.

What do you think?

SamT
09-03-2017, 10:59 AM
I don't blame you, I probably would have done the same.

However the experts here mostly have jobs and often don't come by here for days and even weeks at a time. I'm retired and took up Programming as a hobby.

If you found the answer, you can mark your thread Solved with the Thread Tools link.

FYI, the difference between Date and NOW is that Date returns an integer, where Now returns a decimal number, Excel stores all dates and times as Doubles, then they are formatted for human consumption.

jevi
09-03-2017, 12:46 PM
What you guys are doing is amazing......I just thank you all the time because you share information and you put your time in helping other people. I have been thankful lots of time to people like you and others who had helped me with my question. It is really amazing and admirable. THANK YOU SO MUCH FOR YOUR GREAT WORK.

Marked as Solved.