LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Type Mismatch Error when calling Function

Why am I getting a Type Mismatch error an the line indicated below when call
the function? Thanks in advance!!!

Sub Test()

' test if dimensions are rounded to nearest 16th
Error If InvalidDimensions(tbxHeightFt, tbxHeightIns, tbxWidthFt,
tbxWidthIns) Then
MsgBox "Please round all dimensions to the nearest 1/16''.",
vbCritical
StopCode = True
Exit Sub
End If

End Sub

' ensure dimensions must be rounded to the nearest 1/16th of an inch
Function InvalidDimensions(Hft As Single, Hins As Single, _
Wft As Single, Wins As Single, _
Optional Dft As Single, Optional Dins As Single)
As Boolean

' height
If (Hft = 0 And Hins = 0) Or _
((Hft * 12 + Hins) * 16 < Int(Hft * 12 + Hins) * 16) Then
InvalidDimensions = True
Exit Function
End If

' width
If (Wft = 0 And Wins = 0) Or _
((Wft * 12 + Wins) * 16 < Int(Wft * 12 + Wins) * 16) Then
InvalidDimensions = True
Exit Function
End If

' width
If Not IsMissing(Dft) Or Not IsMissing(Dins) Then
If (Dft = 0 And Dins = 0) Or _
((Dft * 12 + Dins) * 16 < Int(Dft * 12 + Dins) * 16) Then
InvalidDimensions = True
Exit Function
End If
End If

End Function
--
Cheers,
Ryan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Compile Error: ByRef argument type mismatch" when calling my function from another module ker_01 Excel Programming 2 August 14th 08 03:53 PM
runtime error 13 - type mismatch error in Excel 97 on Citrix Kevin Maher Excel Programming 7 March 8th 08 11:48 AM
Type mismatch when calling sub with array of worksheets argument Benjamin[_4_] Excel Programming 3 September 5th 06 03:15 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM


All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"