Run Time error 13 type mismatch

C

cellist

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
 
S

Simon Lloyd

Phil, is the workbook wb already open

cellist;218861 said:
Code
-------------------
Dim days As Varian
Dim hours As Varian
Dim holOptElig As Varian
Dim wb As Workboo
Set wb = Workbooks("Salary and Hourly Summary 2009.xls"
days = wb.Names("MikeNbrHolidays").Valu
hours = wb.Names("MikeTotalHolHours").Valu
If days > 0 The
holOptElig = hours / days <== error on this statemen
End I
-------------------
In "Salary and Hourly Summary 2009.xls", MikeNbrHolidays an
MikeTotalHolHours are formatted as number/0 decimal places an
number/1 decimal places respectively, and their values are 8 an
43.2. When I run this code I get run time error 13, type mismatch.
tried a couple different type for these variables and nothing seem
to help

TIA

Phi

--
Simon Lloy

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com
 
C

cellist

Simon, thanks for your reply.

Yes, the workbook is open and it turns out to be a different problem. Take a
look at my identical posting of a few moments earlier. When I first posted, I
got an error saying the my post had failed due to a system problem, so I
re-posted. Got the error again!! I gave up and when I checked back BOTH
messages had actually posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top