ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Type Mismatch (https://www.excelbanter.com/excel-programming/287371-type-mismatch.html)

Phil Hageman[_3_]

Type Mismatch
 
Getting a Compile error: Type Mismatch. "G26" (including
the quotation marks) is highlighted. Can someone tell me
what is wrong with this code?

Public Function ValidScorecard() As Boolean
Dim sMsg As String
ValidScorecard = True
sMsg = sMsg & CheckRange("G26")
sMsg = sMsg & CheckRange("AG26")
sMsg = sMsg & CheckRange("G44")
sMsg = sMsg & CheckRange("AG44")
If Len(sMsg) 0 Then
MsgBox sMsg
ValidScorecard = False
End If
End Function

Bob Phillips[_6_]

Type Mismatch
 
Phil,

Not much chance if they don't know what CheckRange is. I suggested that you
post it to me, as it works here

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Phil Hageman" wrote in message
...
Getting a Compile error: Type Mismatch. "G26" (including
the quotation marks) is highlighted. Can someone tell me
what is wrong with this code?

Public Function ValidScorecard() As Boolean
Dim sMsg As String
ValidScorecard = True
sMsg = sMsg & CheckRange("G26")
sMsg = sMsg & CheckRange("AG26")
sMsg = sMsg & CheckRange("G44")
sMsg = sMsg & CheckRange("AG44")
If Len(sMsg) 0 Then
MsgBox sMsg
ValidScorecard = False
End If
End Function.




Chip Pearson

Type Mismatch
 
Phil,

What sort of argument is CheckRange expecting? If it is expecting
a range, you need to pass it a range reference. E.g.,

sMsg = sMsg & CheckRange(Range("G26"))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Phil Hageman" wrote in
message ...
Getting a Compile error: Type Mismatch. "G26" (including
the quotation marks) is highlighted. Can someone tell me
what is wrong with this code?

Public Function ValidScorecard() As Boolean
Dim sMsg As String
ValidScorecard = True
sMsg = sMsg & CheckRange("G26")
sMsg = sMsg & CheckRange("AG26")
sMsg = sMsg & CheckRange("G44")
sMsg = sMsg & CheckRange("AG44")
If Len(sMsg) 0 Then
MsgBox sMsg
ValidScorecard = False
End If
End Function





All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com