Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Taranaki, New Zealand
    Posts
    193
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you get an error? If so, which and on what line of the code?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Taranaki, New Zealand
    Posts
    193
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by pieterse View Post
    Do you get an error? If so, which and on what line of the code?

  4. #4
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Taranaki, New Zealand
    Posts
    193
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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