Results 1 to 8 of 8

Macro looping

Threaded View

  1. #1
    Registered User
    Join Date
    12-09-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Macro looping

    Hi all,

    I'm using the following Macro to delete all rows that have a cell containing USD in a column range from F6 to F5000. The macro works but it only deletes a row at a time when run. Can anyone tell me how get this to loop through all rows until the end?

    Thanks (Excel 2003)


    Sub test()
    Dim Last_Row As Long, n As Long
    
    Application.ScreenUpdating = False
        
    
    Last_Row = Range("F6:F5000").End(xlDown).Row
    
    For n = 5 To Last_Row
        If Cells(n, 6).Value = USD Then
            Cells(n, 6).EntireRow.Hidden = False
        Else: Cells(n, 6).EntireRow.Hidden = True
        End If
    Next n
            
    Application.ScreenUpdating = True
    
    End Sub
    Last edited by davesexcel; 03-16-2011 at 06:38 AM. Reason: code tags required, read the forum rules please....Help is assumed in a Help forum.

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