user's position of cursor influences macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Novice macro user needs help. I have a spreadsheet in which I want my user
to intitiate a macro that inserts or deletes rows based on where she
positions the cursor. So, say the user wishes to insert a line above b12.
She positions the cursor on b12 and calls for the macro. How do I program
the macro to accept the user's positioning of the cursor to insert the rows
above the cursor's position? Thanks for sharing your knowledge.
 
Very cool. Thanks. But can I bother you for your assistance with a further
refinement? I'd also like to select the row below, copy and insert the
selection, and then clear the contents in the original rows of the second and
subsequent columns (leaving a formula undisturbed in column A). Is it
possible?
 
Sub abc()
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Offset(1, 0).Copy ActiveCell.EntireRow
Cells(ActiveCell.Row + 1, 2).Resize(1, 255).ClearContents

End Sub
 
Back
Top