Vb help

Please can you help,

I was hoping to amend the two command buttons so that they filter the page based on the dates held in B2:B3

At the moment it uses the filter function, but I was hoping to remove this. I just want to display the dates which fall between B2:B3 in column B
Who is Participating?
Christopher KileCommented:
Note: I tested this with your worksheet:
Christopher KileCommented:
If a date is to be removed, do you want to preserve the row it's in, or can that row be deleted?
Kiwi-123Author Commented:
I would like to preserve the row, or hide it.


Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Christopher KileCommented:
What is it that the filter function is doing that you don't want done?
Gerry BartleySoftware EngineerCommented:
Add visibledropdown:=False

wks.Range("$B$9:$B$1000").AutoFilter Field:=1, _
        Criteria1:=">=" & Format(wks.Range("B2").Value, "mm/dd/yyyy"), _
        Operator:=xlAnd, _
        Criteria2:="<" & Format(wks.Range("B3").Value + 1, "mm/dd/yyyy"), visibledropdown:=False
Christopher KileCommented:
Get rid of the named arguments; the named argument for VisibleDropDown did not seem to be acknowledged, but positional arguments work in this case:


wks.Range("$B$9:$B$1000").AutoFilter 1, _
        ">=" & Format(wks.Range("B2").Value, "mm/dd/yyyy"), _
        xlAnd, _
        "<" & Format(wks.Range("B3").Value + 1, "mm/dd/yyyy"), _

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.