ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compile error: type mismatch (https://www.excelbanter.com/excel-programming/287465-compile-error-type-mismatch.html)

pjhageman

Compile error: type mismatch
 
Excel 2000
I am getting a Compile error: Type Mismatch, "G26" is highlighted. How
do I clear this problem?

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


---
Message posted from http://www.ExcelForum.com/


Rob van Gelder[_4_]

Compile error: type mismatch
 
Looks as though CheckRange wants a range, not a string.
Try:
sMsg = sMsg & CheckRange(Range("G26"))

Rob

"pjhageman " wrote in message
...
Excel 2000
I am getting a Compile error: Type Mismatch, "G26" is highlighted. How
do I clear this problem?

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


---
Message posted from http://www.ExcelForum.com/




pjhageman[_9_]

Compile error: type mismatch
 
Thanks, Rob, this cleared the problem.

Rob van Gelder wrote:
*Looks as though CheckRange wants a range, not a string.
Try:
sMsg = sMsg & CheckRange(Range("G26"))

Rob

"pjhageman " wrote in
message
...
Excel 2000
I am getting a Compile error: Type Mismatch, "G26" is highlighted.

How
do I clear this problem?

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


---
Message posted from http://www.ExcelForum.com/
*



---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 10:23 PM.

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