Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Range function causing runtime error 13 type mismatch

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am getting this error when the code gets to this section. Any help is appreciated.

Tom

Code:
If Range("M9:M" & intLastRow) = "Y" Then
        Else
            Selection.ClearContents
     End If
 
Try changing intLastRow to Str(intLastRow)
Otherwise, try
r$ = ("M9:M" & intLastRow
If Range(r$) = "Y" Then

 
After looking at the issue a little closer I realized the error of my ways. I changed the code to:

Code:
For Each h In Worksheets("ClientProcessing").Range("K9:K" & intLastRow)
        If h.Value <> "Y" Then h.Offset(0, 0) = ""
Next
 
Code:
For Each h In Worksheets("ClientProcessing").Range("K9:K" & intLastRow)
  With h
     If .Value <> "Y" Then .ClearContents
  End With
Next

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top