Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 123
Default Macro for Insert/ Copied Cells

I need a macro that allows a user to Copy/paste a set of rows (named "Style")
whereever the cursor is.

"Style" and is defined as Sheet1!$200:$203

So if my cursor is on row 10, it will Copy all of all rows 200-203 and
insert them at row 10.

thanks in advance for your help
tami
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Macro for Insert/ Copied Cells

Tami, try the below macro..

Sub Mac()
Range("style").Copy Selection
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Tami" wrote:

I need a macro that allows a user to Copy/paste a set of rows (named "Style")
whereever the cursor is.

"Style" and is defined as Sheet1!$200:$203

So if my cursor is on row 10, it will Copy all of all rows 200-203 and
insert them at row 10.

thanks in advance for your help
tami

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Macro for Insert/ Copied Cells

Hi,

If you want to Insert them then you need slightly different code that
suggested in the previous post, which will overwrite the contents of the
destination rows.

Range("Styles").Copy
Cells(ActiveCell.Row, 1).Insert

If on the otherhand, you want to overwrite the current selection try

Range("Styles").Copy Cells(ActiveCell.Row, 1)

This handles the possiblity that the cursor is not in column A which will
generate an error if you try to copy a whole row.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Tami" wrote:

I need a macro that allows a user to Copy/paste a set of rows (named "Style")
whereever the cursor is.

"Style" and is defined as Sheet1!$200:$203

So if my cursor is on row 10, it will Copy all of all rows 200-203 and
insert them at row 10.

thanks in advance for your help
tami

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
Insert copied cells not highlighted Excel Amateur Excel Discussion (Misc queries) 4 September 17th 07 12:24 PM
Insert copied cells Martin B Excel Worksheet Functions 3 August 30th 06 10:47 PM
Insert Copied Cells? HockeyFan Excel Discussion (Misc queries) 2 February 17th 06 01:32 PM
Macro to insert copied cells [email protected] Excel Discussion (Misc queries) 17 January 18th 06 10:40 AM
insert copied cells maryj Excel Discussion (Misc queries) 1 October 24th 05 07:56 PM


All times are GMT +1. The time now is 02:19 PM.

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"