martinsdeee
7/30/2014 - 10:19 AM

Track Cell Changes and execute Macro by keyword

Track Cell Changes and execute Macro by keyword

'------------------------------------------------------
' Procedure : Worksheet_Change
' Date      : 30.07.2014
' Author    : Martins Dumbris
' Purpose   : Track Changes in defined cell and execute 
'           : macro
'------------------------------------------------------

Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim xCell As String
    
    ' Define Cell
    xCell = "$B$2"
    
    
    If Target.Address = xCell Then
        
        ' In Value give "Key" and after "Then" give action (macro or what ever)
        If Range(xCell).Value = "macro 1" Then Call Macro1
        If Range(xCell).Value = "macro 2" Then Call Macro2
        If Range(xCell).Value = "macro 3" Then Call Macro3
        If Range(xCell).Value = "macro 4" Then Call Macro4
        If Range(xCell).Value = "macro 5" Then Call Macro5
        If Range(xCell).Value = "kartupelis" Then Call Kartupelis
        
    End If
    
End Sub