maabadi
Well-known Member
- Joined
- Oct 22, 2012
- Messages
- 2,681
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi.
I want to find first date at Column C between today and next 15 days. I try many methods but always see Type Mismatch Error
I declare as Variant
I convert Date to number with CLng or CDbl, but See error again?
What is Problem?
I want to find first date at Column C between today and next 15 days. I try many methods but always see Type Mismatch Error
I declare as Variant
I convert Date to number with CLng or CDbl, but See error again?
What is Problem?
VBA Code:
Sub IndexMatchDates()
Dim A As Long, P As Long
A = Application.Match(1, Application.Index((Range("C1:C21") > CLng(Date) - 1) * (Range("C1:C21") < CLng(Date) + 16), 0, 1), 0)
P = Application.Index(Range("C1:C21").Value2, Application.Match(1 _
, Application.Index((Range("C1:C21").Value2 > CDbl(Date) - 1) * (Range("C1:C21").Value2 < CDbl(Date) + 16), 0, 1), 0))
Debug.Print A
Debug.Print P
End Sub