Hi
I discovered the following code on the net to find a certain date in a certain range:
Bearing in mind that the native format of my excel is "dd / mm / yyyy", that is, European system, what is wrong with the code so as not to detect where the date is looking for?
The dates in the range are calculated and not entered manually, and are on line 10 and are hidden.
What I need is to find a certain date, in this case 01/04/2020, by the Find method, in a hidden line. It's possible? What's the code?
Thank you for your help
Jorge Cabral
I discovered the following code on the net to find a certain date in a certain range:
Code:
Sub FindAll()
Dim FirstFound As String, FirstAddress As String
Dim StartRng As Range, Rng As Range
Dim StartDate As Date
'
' DATE TO FIND DATE TO FIND DATE TO FIND
'
StartDate = DateSerial(Year(Date), Month(Date), 1)
'
'
'
Set StartRng = PLANEAMENTO.Range("P10:BW10").Find(What:=DateValue(StartDate), LookAt:=xlWhole, LookIn:=xlValues)
If Not StartRng Is Nothing Then
FirstFound = StartRng.Address
Else
GoTo NothingFound
End If
Set Rng = StartRng
Do Until StartRng Is Nothing
Set StartRng = PLANEAMENTO.Range("P10:BW10").FindNext(After:=StartRng)
Set Rng = Union(Rng, StartRng)
If StartRng.Address = FirstFound Then Exit Do
Loop
MsgBox Rng.Address ' Rng.Column
Exit Sub
NothingFound:
MsgBox "No values were found in this worksheet"
End Sub
The dates in the range are calculated and not entered manually, and are on line 10 and are hidden.
What I need is to find a certain date, in this case 01/04/2020, by the Find method, in a hidden line. It's possible? What's the code?
Thank you for your help
Jorge Cabral