insering rows with vb

  • Thread starter Thread starter katie
  • Start date Start date
K

katie

Hi
This piece of code inserts a new row on the current
worksheet, above the active cell.




Private Sub CommandButton1_Click()

ActiveCell.Resize(1, 1).EntireRow.Insert

End Sub



Anyone know how this can be expanded to insert a new row
in exactly the same position on worksheet 2?
Many Thanks
katie
 
Katie,

Here it goes:

Worksheets("Sheet2").Rows(ActiveCell.Row).EntireRow.Insert

HTH,
Nikos
 
Private Sub CommandButton1_Click()

Dim loRow
loRow = ActiveCell.Row

Activesheet.Range(loRow & ":" & loRow).Insert
Sheets(2).Range(loRow & ":" & loRow).Insert

End Su
 
Back
Top