View Full Version : CAll a macro on entering data to a cell under a column
sujittalukde
04-14-2008, 04:37 AM
How to call a macro when a data is entered on any cell under column A of sheet1? ie if  say 100 is written at cell A5 and pressed enter, a macro named Macro1 should fire. However A1 should be left as this is the header row.
mikerickson
04-14-2008, 06:02 AM
You could put something like this in the sheet's code module
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Cells.Count = 1 And Target.Column = 1 Then
    Application.EnableEvents = False
    
    Call columnAMacro
    
    If Target.Address = "$A$5" And Target.Value = 100 Then
        Call Macro1
    End If
    
    Application.EnableEvents = False
End If
End Sub
sujittalukde
04-14-2008, 10:28 PM
Thanks mike but I want to call a macro for every cell change in the column A.
mdmackillop
04-15-2008, 12:12 AM
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Cells.Count = 1 And Target.Column = 1 Then
        Application.EnableEvents = False
        Select Case Target
        Case Is = 100
            Call Macro1
        Case Is = 200
            Call Macro2
        Case Else
            'do nothing
        End Select
        Application.EnableEvents = False
    End If
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.