Function to return column where a date is entered

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top