Function to return column where a date is entered

  • Thread starter Thread starter Barb Reinhardt
  • Start date Start date
B

Barb Reinhardt

I'd like to have a function something like this:

Function FindDateColumn(myWS as worksheet, myDate as Date)

I want to find the first (and probably only entry) of a specific date on a
worksheet and return the date column. I can't seem to get it to return
anything. I'd show my code, but unfortunately, it's at work and I"m not.
It seems to be format specific somehow. Can someone help?

Thanks,
Barb Reinhardt
 
If you are passing a worksheet from the spreadsheet to VBA its best to pass
the string name. try this code

Function FindDateColumn(myWS As String, myDate As Date)

Worksheets(myWS).Select
FindDateColumn = _
Selection.Find(what:=myDate, LookIn:=xlValues)

End Function
 
Back
Top