Results 1 to 2 of 2

Run-time error '1004': Method 'Range' of object 'Global' failed

Threaded View

  1. #1
    Registered User
    Join Date
    02-22-2012
    Location
    Sand Creek, Wisconsin
    MS-Off Ver
    Excel 2003
    Posts
    1

    Run-time error '1004': Method 'Range' of object 'Global' failed

    I am using the following macro code in a spreadsheet to hide rows and it works. However, when I copied it to another spreadsheet I am getting the above error message. The Macro should hide all rows with a 1 in the cell in column AJ. I am very inexperienced with Macros so any help would be fantastic.

    Sub HideMyRows()
    Application.ScreenUpdating = False
        Dim R As Range
        With ActiveSheet
            For Each R In Range("AJ8:AJ95" & Cells(Rows.Count, 2).End(xlUp).Row)
                If R.Value = 1 Then
                    R.EntireRow.Hidden = True
                End If
            Next
        End With
        Application.ScreenUpdating = True
    End Sub
    Thanks
    Last edited by djwestholm; 02-22-2012 at 05:06 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1