Link to home
Start Free TrialLog in
Avatar of Norman Fite
Norman Fite

asked on

macro to search date columns for selected date then down that column

I have been trying to write a macro that searches across date headers and then on correct date will search down that column for selected time.
  See the attachment.  
The date column headers will of course change with the date.  
Check out the workbook and see if you can help me.. I have been struggling with search functions..

Thanks,
NormExperts_Exch_help.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Norie
Norie

Norm

You could use this to find the column.
dtDateToFind = Date
    
varDateCol = Application.Match(CDbl(dtDateToFind), Sheets("Sheet1").Rows(4), 0)
    

Open in new window

Then, if the time values are in 15 minute periods you can use this to find the row.
dtTimeToFind = TimeValue("03:15")

lngTimeRow = dtTimeToFind * 96 + 7

Open in new window


Together you can create ranges that refer to the Duration and Details cells like this.
Set rngDuration = Sheets("Sheet1").Cells(lngTimeRow, varDateCol+1)
Set rngDetails = Sheets("Sheet1").Cells(lngTimeRow, varDateCol+2)

Open in new window

Avatar of Norman Fite

ASKER

Thank You, I will study this...for some reason, I have a hard time with search strings and variables..
Norm
Again, you have come to my rescue.  This is a solution, that will allow me to move on and find other things I don't know how to do..
  Neeraj, you did it again, Thank you
Norie, I appreciate your input and will study what you have sent me..

Thank Both of you..
Well worth the subscription price..

Norm
You're welcome Norm! Glad I could help.
Thanks for the feedback!