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!

Excel 2003 Error 13 Type mismatch

Status
Not open for further replies.

vladk

Programmer
May 1, 2001
991
US
Hello everyone

This code breaks on line 1 with that error

Code:
Private Sub HideExtrapolatingLines(ByRef ioobjWsht As Worksheet)
    
    Const METHOD_NAME As String = "HideExtrapolatingLines"
    
    On Error GoTo MethodExit

1   ioobjWsht.Rows("307:310").EntireRow.Hidden = True
2   ioobjWsht.Rows("263:268").EntireRow.Hidden = True
3   ioobjWsht.Rows("200:211").EntireRow.Hidden = True
4   ioobjWsht.Rows("157:162").EntireRow.Hidden = True
5   ioobjWsht.Rows("95:105").EntireRow.Hidden = True
6   ioobjWsht.Rows("52:57").EntireRow.Hidden = True
    
MethodExit:
    
    If Err.Number <> 0 Then
        MsgBox "Error " & CStr(Err.Number) & " in " & METHOD_NAME & vbCr & Err.Description & vbCr & Erl
    End If
    
End Sub

This is the call:
Code:
    Dim objWsht As Worksheet
    HideExtrapolatingLines objWsht

The code does work in debug mode and does not work when I let it run with F5.

Can anybody explain why?

Thank you!




 


hi,
Code:
    Dim objWsht As Worksheet

    [b][highlight]Set objWsht = ????????[/highlight][/b]

    HideExtrapolatingLines objWsht


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip,

Actually, I had to activate sheet in code, don't understand why, it was activated anyway!

Thank you!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top