Macro for Insert/ Copied Cells

T

Tami

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
 
J

Jacob Skaria

Tami, try the below macro..

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

If this post helps click Yes
 
S

Shane Devenshire

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top