• Problems with macro

    • This topic has 4 replies, 2 voices, and was last updated 15 years ago.
    Author
    Topic
    #468940

    Hi there
    I have written a macro and on the workbook I have on my machine it works great – macro below – however, my client has problems, so he emailed the workbook back to me.
    He opened it in 2007 but saved it as 2003. There are 3 worksheets with the same macro and on 1 it works great, but on the other 2 I get an error. The line oCell.EntireRow.Hidden = True is the problem here. Why would it work on 1 sheet and not on the other 2 sheets ?? On the copy I received from him, it indeed doesn’t work for me too.
    It has me baffled…

    Please help – Thanks heaps

    The macro is
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim oCell As Range
    If Not Intersect(Range(“d5:d400”), Target) Is Nothing Then
    Application.ScreenUpdating = False
    For Each oCell In Intersect(Range(“d5:d400”), Target).Cells
    If oCell.Value = “Yes” Then
    oCell.EntireRow.Hidden = True
    End If
    Next oCell
    Application.ScreenUpdating = True
    End If
    End Sub

    Viewing 2 reply threads
    Author
    Replies
    • #1224112

      Do you get an error? If so, which and on what line of the code?

      • #1224165

        Do you get an error? If so, which and on what line of the code?

    • #1224170

      Yes, the line is

      oCell.EntireRow.Hidden = True

      and the message sayd “Run-time error 1004 – Unable to set the Hidden property of the Range class”

      Thanks

    • #1224252

      The code as such is OK, so something else is going on here.
      Maybe the worksheet in question is protected?
      What if you try to hide the row manually?

    Viewing 2 reply threads
    Reply To: Problems with macro

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: