View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
WLMPilot WLMPilot is offline
external usenet poster
 
Posts: 470
Default Type Mismatch error

Below is part of the code I am using. I get a "Type Mismatch" error on the
line I indicate as "<----ERROR" Why?

Basically, this routine takes the dates for paid holidays (holdate) and
compares it to the date (on active row) + 7 days. If holdate < wdate+7, then
the current cell value(cv) is pulled in. I then add the holiday hours
(holhr) to cv and reinsert it back in the spreadsheet.

DIM cv, holhr(11) as Variant "I guess this is correct Dim for ##.## format

For Each Cell In rngpc
wdate = Cell.Offset(0, -13).Value 'Get Beg of week date
For cntr = 1 To cnt - 1
cv = Cell.Value 'Get value of cell
MsgBox holdate(cntr) & " < " & wdate + 7 & " CV= " & cv
If holdate(cntr) < wdate + 7 Then
Cell.Value = cv + holhr(cntr) <======ERROR
End If
Next cntr
Next Cell

Thanks for your help!

Les