Hi all,
Same project as yesterday...different problem!
I have a list of dates relating to various stages in a project. What I'd like to do is when a button is pressed on the spreadsheet a user form pops up - this is done, no problem. On the userform I have two sets of data input - the first is a combo box which displays the various stages of the project (i.e. column headers). The second is a text box where the user enters a date - dd/mm/yyyy.
On the worksheet I have an autofilter across the header columns. What I'm trying to do is when the 'Search' button is pressed, get the code to run the autofilter on a column depending on which entry is chosen from the drop down on the combo box. e.g: if 'Feasibility Upload' is chosen the autofilter on column B is run, if 'RD Sign Off' is chosen the autofilter on column H is run, etc.
The date part isn't such a biggie. I'm going to use something along the lines of:
Private Sub projSearch_Click()
Dim sData As String
sData = dateData
Selection.AutoFilter Field:=1, Criteria1:=sData
Unload Me
End Sub
However, the line:
Selection.AutoFilter Field:=1, Criteria1:=sData
...needs to be dependent on the combo box. One last thing, if the date isn't in the column I'd like a message to come up saying something along the lines of "Date not found".
Hope that makes sense. Any help greatly appreciated.
TIA,
SamuelT
Bookmarks