views:

35

answers:

1

hello, i am new to VBA and i want to create a macro in excel that add a row when i reach a certain cell. any help appreciated

+3  A: 

You can add the below to the SelectionChange event of the worksheet and change the condition as necessary.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Row = 2 Then
    Selection.EntireRow.Insert
End If

End Sub
Henryk