Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Conditional Formatting - Run Time Error '13' Type Mismatch Error | Excel Programming | |||
Type Mismatch Error | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error | Excel Programming |