Results 1 to 4 of 4

Worksheet_Change(ByVal Target As Range) - set to only update when 3 target cells changed?

Threaded View

trillium Worksheet_Change(ByVal Target... 11-07-2012, 01:00 PM
xladept Re: Worksheet_Change(ByVal... 11-07-2012, 01:44 PM
trillium Re: Worksheet_Change(ByVal... 11-07-2012, 03:03 PM
xladept Re: Worksheet_Change(ByVal... 11-07-2012, 06:40 PM
  1. #1
    Registered User
    Join Date
    08-08-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2010
    Posts
    85

    Worksheet_Change(ByVal Target As Range) - set to only update when 3 target cells changed?

    Hi!

    I have seen similar posts for this however when I tried to employ the suggestions/code it wouldn't work for me.

    I have an excel book that has a form that users need to fill out and then "sign" to say they have done what they were suppsed to do.

    What I want to have happen is that when they select 3 different cells on this tab, different rows hide or unhide etc. Right now the only way I can get it to run is to do it through <<Private Sub Worksheet_Change(ByVal Target As Range)>>.

    But this means that when other actions happen on this tab (i.e. other buttons/macros run, other cells have data entered into them) the this private sub macro is continually firing.

    How can I make it fire ONLY when either or both of these 3 "target" cells are changed? These cells are E6 (named as "TypeofWork"), E7 (named "AddClientLine") and S43 (named "TotalTriggers").

    Any help would be much appreciated!

    Private Sub Worksheet_Change(ByVal Target As Range)
    ' Oct 11, 2012
    ' hide rows if ASO or Financial review required
    ' unhide rows to correspond to the # of clients being shown
    
    Dim sChoose As String
    
    With Application
            CalcMode = .Calculation
            .Calculation = xlCalculationAutomatic
            .ScreenUpdating = False
    End With
    
            
    ''''''''''''''''''''
    'unprotects sheet
        Sheets("FinancialPeerReviewUWForm").Unprotect
    ''''''''''''''''''''
    
    
    ''''''''''''''
    'starts off form with #PR item row hidden, will unhide if needed
    ''''''''''''''
    Range("PRTriggered").Select
    Selection.EntireRow.Hidden = True
    '''''''''''''''
    
    sChoose = Range("E6").Value
    
    Select Case sChoose
    
    Case Is = "Choose One" 'show all rows
        Range("24:46").Select
        Selection.EntireRow.Hidden = True
        Range("79:84").Select  'hides ASO section if chose one
        Selection.EntireRow.Hidden = True
    
        Range("E6").Select 'sets resting spot
        
    Case Is = "Financial" 'show just rows for Financials
        Range("30:30").Select
        Selection.EntireRow.Hidden = True
        Range("24:29,31:46").Select
        Selection.EntireRow.Hidden = False
        Range("79:84").Select  'hides ASO section if Financial chosen
        Selection.EntireRow.Hidden = True
       
        
        Range("E6").Select 'sets resting spot
        
    Case Is = "ASO Rec" 'show just rows for ASO recs
        Range("30:30,31:31,33:33,36:36").Select
        Selection.EntireRow.Hidden = False
        Range("25:29,31:31,34:35,37:42").Select
        Selection.EntireRow.Hidden = True
        
        Range("E6").Select 'sets resting spot
        
    End Select
    
    '''''''''''''''''''
    Call AddClient    ' macro to unhide rows if needed for extra client lines
    '''''''''''''''''''
    
    ''''''''''''''''''
    'hide # PR triggered row if nothing triggered
    If Range("TotalTriggers") >= 1 Then
    Range("PRTriggered").Select
    Selection.EntireRow.Hidden = False
    End If
    Range("C24").Select 'sets resting spot
    
    ''''''''''''''''''
    
    
    Application.ScreenUpdating = True
    
    
    End Sub
    Last edited by trillium; 11-07-2012 at 01:41 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