just a typo
DateSerial(year(date),month(dt)-i,1)
should be
DateSerial(year(date),month(date)-i,1)
so
Dim dt(1 to 2) as Date, i as Long
Dim s1 as String, s2 as String
for i = 1 to 2
dt(i) = DateSerial(year(date),month(date)-i,1)
Next i
s1 = ucase(format(dt(1),"yyyy\\mmm yyyy\\")) _
& format(dt(1),"\[\d\p\-mmyy")
s2 = ucase(format(dt(2),"yyyy\\mmm yyyy\\")) _
& format(dt(2),"\[\d\p\-mmyy")
cells.Replace What:=s2, _
Replacement:=s1, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
--
regards,
Tom Ogilvy
"Lotus123" wrote:
Tom Ogilvy Wrote:
dt(i) = DateSerial(year(date),month(dt)-i,1)
Thanks Tom! When I run the macro I get the message:
Run-time error '13':
Type mismatch
When I run the debugger it stops on the above line.
--
Lotus123
------------------------------------------------------------------------
Lotus123's Profile: http://www.excelforum.com/member.php...o&userid=28611
View this thread: http://www.excelforum.com/showthread...hreadid=549518