I'm trying to automatically update the date range on the top of my report in Excel based on the date range from data I download from a text database. In the below listed macro I get a Run-time error '13': Type mismatch on
PEndDt = Right(PaidDateRange, 8).
I think the Date variable, PEndDt, does not like getting a String. But I've assigned strings to Date variables in other macros! I don't now how to fix this. Help please.
Sub test() Dim PEndDt As Date Dim PaidDateRange As String PaidDateRange = "PAID DATE 1/01/13 - 9/31/13" PEndDt = Right(PaidDateRange, 8) Range("A1") = "Report thru " & Format(PEndDt, "Long Date") End Sub