Must range be selected before a paste can be done?

M

MichaelDavid

Greetings! I was wondering if there is a shorter or a quicker way of
accomplishing
the following:

Range("A315:A999").Cut
Range("A300").Select
ActiveSheet.Paste
Range("C315:AE999").Cut
Range("C300").Select
ActiveSheet.Paste

I tried:
Range("A315:A999").Cut
Range("A300").Paste
Range("C315:AE999").Cut
Range("C300").Paste

but the error message I obtained upon execution said something about the
paste method not being supported here. Any help/advice will be greatly
appreciated.

May you have a blessed day.
--
May you have a most blessed day!

Sincerely,

Michael Fitzpatrick
 
F

FSt1

hi
one thing you might do is realize that you don't have to cut/copy/paste.
cut/copy/paste is a windows functions, not an excel function. excel (as all
windows applications) just uses this function.

try this...
Range("C315:AE999").value = Range("A315:A999").Value
Range("A315:A999").ClearContents

Here you are just swaping values around. trick is that both ranges must be
the same size.
seldom do you need to select and seldom to you need to cut/copy/paste unless
you just want to. and it's not a good idea to use cut/copy/paste in a loop.
if the loop is long enough, you might crash the macro due to memory problems.

regards
FSt1
 
J

JLGWhiz

Use one line:

With ActiveSheet
Range("A315:A999").Cut Range("A300")
Range("C315:C999").Cut Range("C300")
End With
 
J

JLGWhiz

Forgot the dots.

With ActiveSheet
.Range("A315:A999").Cut Range("A300")
.Range("C315:C999").Cut Range("C300")
End With
 
M

MichaelDavid

Greetings! Thanks a million. After I fixed the range limits as follows, your
solution worked perfectly:

With ActiveSheet
.Range("A315:A999").Cut Range("A300")
.Range("C315:AE999").Cut Range("C300")
End With

--
May you have a most blessed evening!

Sincerely,

Michael Fitzpatrick
 
M

MichaelDavid

Greetings! Thanks for your kind help. I tried JLGWhiz's solution first and it
worked, and being lazy, I decided to use it. If JLGWhiz's solution failed,
then I would have tried yours. Perhaps you can give me some input as to which
solution you think is superior (faster, less trouble prone, etc.) and why.
Thanks again for your kind help.
--
May you have a most blessed day!

Sincerely,

Michael Fitzpatrick
 

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