Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
pda pda is offline
external usenet poster
 
Posts: 6
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
pda pda is offline
external usenet poster
 
Posts: 6
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
pda pda is offline
external usenet poster
 
Posts: 6
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cursor position MarkT Excel Discussion (Misc queries) 5 February 7th 07 01:25 PM
How do you set cursor position at current date in macro? Tom Robertson Excel Worksheet Functions 1 May 28th 06 03:50 PM
Help: Making a copying macro from cursor position ? -[::::Shamran::::]- Excel Programming 4 February 27th 05 01:16 PM
Cursor Position in VBE ehntd[_4_] Excel Programming 1 November 2nd 04 05:50 PM
cursor position choice[_2_] Excel Programming 1 August 22nd 04 11:49 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"