View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default automatically insert row

Go to The Visual Basic Editor and make sure you are showing the Project
Explorer (View menu). In the Project Explorer highlight and select
(double-click) the line for the worksheet you want to do this for. Now in
the code pane put this event procedure (event procedures run when certain
events take place; this one runs when any cell in the worksheet is changed):

Private Sub Worksheet_Change(ByVal Target As Range)

' Target refers to the cell that was changed
With Target
' If it is column O and if Column B has "FY2005":
If (.Column = 15) And .EntireRow.Cells(1, 2) = "FY2005" Then
' Insert the row
.EntireRow.Insert
' Put FY2006 in the new row column B
.EntireRow.Cells(0, 2) = "FY2006"
End If
End With

End Sub


"Leslie" wrote:

Is there a way to automate this process. When a value is entered into Col. O
which is "Jun" and in Col B in that same row is the label "FY 2005" I want a
row inserted above that row and I want "FY 2006" to be put in the new row
Col. B. Thanks for any ideas. I'm new to this programming stuff so all
specifics are very much appreciated.