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 |
Type Mismatch error
I'd check to see what CV held and what cntr held and what holhr(cntr) held.
WLMPilot wrote: 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 -- Dave Peterson |
All times are GMT +1. The time now is 03:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com