Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel Type Mismatch on some PCs (Excel 2002)

    I have an Excel workbook which has some code on one of the sheets. All this
    does is hide or unhide rows depending on whether there word true is found in
    column C (in the row thath will be hidden or revealed). The true/false is
    created from a tick box which the user selects, there are a number of them.
    So far, its all straight forward and this works on 98% of peoples PCs, but
    some people get a Run time error, type mismatch when they click a tick box.
    They are all running the same system Win XP and Excel 2002. Has anybody got
    any ideas on how to fix this? Dummy file attached.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Excel Type Mismatch on some PCs (Excel 2002)

    Welcome to Woody's Lounge!

    Can you find out on which line the error occurs? (Users should get an error message box with End, Debug and Help buttons. Clicking Debug will activate the Visual Basic Editor, with the offending line highlighted.)

  3. #3
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Type Mismatch on some PCs (Excel 2002)

    The trouble with that is I password protect VBA so the user gets an error message but doesn't have the option to debug etc....hmmmn......

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Excel Type Mismatch on some PCs (Excel 2002)

    Go to their computer, unprotect the code and run it and debug at their location.

    Steve

  5. #5
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Type Mismatch on some PCs (Excel 2002)

    Not as easy as it sounded since I work remotely and the nearest users is 135miles away, but got there in the end. The code falls over at the following line: "If cell = True Then cell.EntireRow.Hidden = False", though I don't understand why as it works on my PC???

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Excel Type Mismatch on some PCs (Excel 2002)

    Is cell declared as Dim cell As Range?

    You might try using If cell.Value = True Then ...

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Type Mismatch on some PCs (Excel 2002)

    Try changing your SheetB worksheet activate code to this:

    <pre>Private Sub Worksheet_Activate()
    Dim cell As Range

    Application.ScreenUpdating = False

    For Each cell In Range("C6:C47")
    If cell.Interior.ColorIndex = 45 Then
    cell.Value = False
    End If
    Next cell

    For Each cell In Range("C6:C47")
    If cell.Value = True Then
    cell.EntireRow.Hidden = False
    Else
    cell.EntireRow.Hidden = True
    End If
    Next cell

    Application.ScreenUpdating = True

    End Sub
    </pre>

    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •