View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1025_] Simon Lloyd[_1025_] is offline
external usenet poster
 
Posts: 1
Default Run Time error 13 type mismatch


Phil, is the workbook wb already open?

cellist;218861 Wrote:

Code:
--------------------

Dim days As Variant
Dim hours As Variant
Dim holOptElig As Variant
Dim wb As Workbook
Set wb = Workbooks("Salary and Hourly Summary 2009.xls")
days = wb.Names("MikeNbrHolidays").Value
hours = wb.Names("MikeTotalHolHours").Value
If days 0 Then
holOptElig = hours / days <== error on this statement
End If

--------------------

In "Salary and Hourly Summary 2009.xls", MikeNbrHolidays and
MikeTotalHolHours are formatted as number/0 decimal places and
number/1 decimal places respectively, and their values are 8 and
43.2. When I run this code I get run time error 13, type mismatch. I
tried a couple different type for these variables and nothing seems
to help.

TIA,

Phil



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=60147