ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   user's position of cursor influences macro (https://www.excelbanter.com/excel-programming/368686-users-position-cursor-influences-macro.html)

pda

user's position of cursor influences macro
 
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.

Tom Ogilvy

user's position of cursor influences macro
 
activecell.EntireRow.Insert

--
Regards,
Tom Ogilvy


"pda" wrote:

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.


pda

user's position of cursor influences macro
 
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?

"Tom Ogilvy" wrote:

activecell.EntireRow.Insert

--
Regards,
Tom Ogilvy


"pda" wrote:

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.


Tom Ogilvy

user's position of cursor influences macro
 
Sub abc()
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Offset(1, 0).Copy ActiveCell.EntireRow
Cells(ActiveCell.Row + 1, 2).Resize(1, 255).ClearContents

End Sub

--
Regards,
Tom Ogilvy



"pda" wrote in message
...
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?

"Tom Ogilvy" wrote:

activecell.EntireRow.Insert

--
Regards,
Tom Ogilvy


"pda" wrote:

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.




pda

user's position of cursor influences macro
 
Thanks for the help! The form is much easier for the user to manage now!

"Tom Ogilvy" wrote:

Sub abc()
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Offset(1, 0).Copy ActiveCell.EntireRow
Cells(ActiveCell.Row + 1, 2).Resize(1, 255).ClearContents

End Sub

--
Regards,
Tom Ogilvy



"pda" wrote in message
...
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?

"Tom Ogilvy" wrote:

activecell.EntireRow.Insert

--
Regards,
Tom Ogilvy


"pda" wrote:

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.






All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com