Run time error 13, type mismatch
Thanks Mike, that fixed it. deja vu to my C programming days. You know, does
the variable hold the value I want or is it a pointer to the value I want.
"Mike H" wrote:
Hi,
The syntax your using is returning the address of the named range try this
instead
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").RefersToRange
hrs = wb.Names("MikeTotalHolHours").RefersToRange
If days 0 Then
holOptElig = hrs / days '<== error on this statement
End If
Mike
"cellist" wrote:
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. I get run time error 13, type mismatch when I run this code.
TIA,
Phil
|