Cut and Paste Macro

G

Guest

I have a sheet with the following macro, actually this is just part of it. If
I'm correct it cuts rows from sheet 9 Rows("2:11") and pastes them to sheet
1("A7"). it works fine, however I would like to modify it so that it cuts the
rows, but skips columns (cells) BX, BY, BZ in each row. These columns (cells)
have formulas that become overwritten when the current macro runs. is there a
way to make this work?

Sheets("Sheet9").Select
Rows("2:11").Select
Selection.Copy
Sheets("Sheet1").Select
Range("A7").Select
ActiveSheet.Paste

Thanks,
M.A.Tyler
 
J

JE McGimpsey

One way:

With Sheets("Sheet9")
.Range("A2:BW11").Copy Destination:=Sheets("Sheet1").Range("A7")
.Range("CA2:IV11").Copy Destination:=Sheets("Sheet1").Range("CA7")
End With

Note that no selection is needed. Working with range objects directly is
usually faster and produces more manageable code.
 
P

Pete_UK

Instead of your second line:

Rows("2:11").Select

make this:

Range("A2:BW11").Select

If you have any data beyond column BZ that you also want to cut/paste,
then just repeat the lines you have but with the range CA2:IV11, and
instead of Range("A7").Select you would have Range("CA7").Select.

Hope this helps.

Pete
 
G

Guest

Both of these worked great!

Pete_UK said:
Instead of your second line:

Rows("2:11").Select

make this:

Range("A2:BW11").Select

If you have any data beyond column BZ that you also want to cut/paste,
then just repeat the lines you have but with the range CA2:IV11, and
instead of Range("A7").Select you would have Range("CA7").Select.

Hope this helps.

Pete
 

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