Results 1 to 3 of 3

Cancel MACRO if a certain condition arises in a cell

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Cancel MACRO if a certain condition arises in a cell

    Hi I have this code:

    
    Private Sub Worksheet_Activate()
    
        Dim rRow             As Range
        Dim rRowRange        As Range
        Dim rCell            As Range
        Dim bHide            As Boolean
        
        ' change as you need
        Set rRowRange = Intersect(UsedRange, Range("B9:B50"))
    
        ActiveWindow.DisplayZeros = False
        Application.ScreenUpdating = False
    
        For Each rRow In rRowRange.Rows
            bHide = False
            For Each rCell In rRow.Cells
    
                If Len(rCell.Value) = 0 Then
                    bHide = True
                    Exit For
                End If
            Next rCell
            rRow.EntireRow.Hidden = bHide
    
        Next rRow
    
        Application.ScreenUpdating = True
    
    End Sub
    Right now the MACRO is Running when the worksheet is activated. But I DO NOT want it to RUN....
    IF THE FOLLOWING IS TRUE...

    =IF('S-57 (Special Req)'!J6=0)



    Can someone edit my code above to reflect this condition????
    Thanks for your help!
    Last edited by nenadmail; 07-28-2012 at 03:10 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