I receive a workbook that contains information about the processing volumes of a call center team. I have no way of modifying the format or layout of the workbook upstream.
One sheet contains information about processing errors.
(team members' user IDs redacted)
Each date is represented by a merged 1x3 range with the date in question formatted as "dd-mmm" e.g. "01-Jun"
That date is pulled via formula from another sheet with the same layout. The formula for one such range reads: ='QA Scores'!K2:M2
I attempted to use Range.Find
to locate the first day of a given month and an end date in that same month (based on user input) - e.g. June 1 through June 15.
Set rngMin = .Find(What:=DateValue(minDate), _
LookIn:=xlFormulas, _
LookAt:=xlWhole)
In other uses, I located a date in this manner, but the added complexity of the value coming from a formula seems to be the issue here.
UPDATE:
I have written the following based on Ron Rosenfeld's answer:
Dim UsedArr As Variant: UsedArr = SrcWS.UsedRange
blFound = False
For i = LBound(UsedArr, 1) To UBound(UsedArr, 1)
For j = LBound(UsedArr, 2) To UBound(UsedArr, 2)
If UsedArr(i, j) = MinDate Then
blFound = True
Exit For
End If
Next
If blFound = True Then Exit For
Next
Range.Find
persists its optional parameters between calls - a nasty bug-prone behavior; make sure you specify all parameters every time to avoid it biting you. – FunerealxlValues
the right way? – PhrygianxlValues
only examines the.Text
property of what's displayed on the worksheet. – MonsourFormat(DateValue(minDate),"[$-en-US]dd-mmm")
withxlValues
also does not work? – PhrygianxlValues
is looking at more than just the.Text
property... – MonsourUsedArr = SrcWS.UsedRange.Value2
andIf UsedArr(i, j) = CDbl(MinDate)
Value2
is a bit faster, and completely removes any formatting issues from consideration.Value
will work, but requires more conversions internally to equate. – Gaseous