+ Reply to Thread
Results 1 to 2 of 2

Auto-activation script

Hybrid View

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    18

    Auto-activation script

    Hi guys,

    I found script which trigger the macro when they are changed

       Private Sub Worksheet_Change(ByVal Target As Range)
     Dim KeyCells As Range
    
        ' The variable KeyCells contains the cells that will
        ' cause an alert when they are changed.
        Set KeyCells = Range("B24:B26")
        
        If Not _
        Application.Intersect(KeyCells, Range(Target.Address)) _
        Is Nothing _
        Then
    
    Call cell_value
           
        End If
    End Sub
    But this actually not what I need

    I need 1 more line which will check if any of cells in range B24:B26 is equal to "None" and if "yes" then do nothing if "No" then do same think that above script is doing.

    I tried to change it by myself but it is not working

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim KeyCells As Range
    
        ' The variable KeyCells contains the cells that will
        ' cause an alert when they are changed.
    If ActiveSheet.Range("B24").Value = "None" _
    Or ActiveSheet.Range("B25").Value = "None" _
    Or ActiveSheet.Range("B26").Value = "None" _
    Then
            ' do nothing
    Else
        Set KeyCells = Range("B24:B26")
        
        If Not _
        Application.Intersect(KeyCells, Range(Target.Address)) _
        Is Nothing _
        Then
    
    Call cell_value
           
        End If
    End If
    
    End Sub
    Can some one correct this?

    Thank you
    Last edited by Skorpionkz; 03-28-2013 at 11:32 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Auto-activation script

    Is this solved?

    If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

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