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.
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.
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
Thanks mike but I want to call a macro for every cell change in the column A.
[VBA]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
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'