'find a date in multiple cell and return some values vba
So it's a little complicated what I need. Therefore bare with me .
I need to find a date which will be taken from a sheet called "Raport". Cell where data validation of the date is "D4". I need that date to be searched in multiple sheets. Each sheet is showing like this:

The problem is that based on selected date, on P2P or S2S, based on sheet name and based on shift pattern, I need to return the value of Target and Value of actual (which is in hh:mm:ss).
Conditions:
P2P and S2S are the columns where the dates are entered. If P2P is Empty it means it was used S2S and vice versa. (FYI.. This happens when its pressed a button, which means the time stamp is placed automatically) P2P time could be 00:40:00 or 00:20:00, while S2S is always 00:14:00.
Sheet name is a fixed name L1_4701A, L2_4701B, L3_4701C, L4_4701D, L5_4701E, L6_4701F, L7_4701G, L8_4701H. Each sheet in addition to its name has a date of the file when it was extracted e.g.: "L1_4701A 25_03"
Shift Patterns is ' Shift 3 - 22:00:01 - 00:00:00 ' 00:00:01 - 06:00:00 (This is on the next day) 'Shift 1 06:00:01 - 14:00:00 'Shift 2 14:00:01 - 22:00:00
After selecting the date, I need to place the data according to which sheet name is (without date) L1_4701A, L2_4701B, L3_4701C, L4_4701D, L5_4701E, L6_4701F, L7_4701G, L8_4701H into another sheet, which is dedicated for collecting all data.

In Column Target and Actual I need to sum of all items from Target and Actual based on shift patterns.
If it's not the right thread, I'll kindly ask you to tell me as this is my firs post.
Thank you
I managed to find a date in a cell based on what it searches..
This is from a previous file which I have done it last week:
Sheets("Day").Select
Range("L3:M3").Select
Application.CutCopyMode = False
Selection.Copy
Cells.Find(What:=Range("L3"), After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
The problem here is that this is searching in a place where there are no spaces between cells and it search only in one column. The new search, which is much more complicated has to take care of the blank cell and also the date regarding 2 columns.
I have no idea how to adapt it based also on the shift pattern.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
