Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Must range be selected before a paste can be done?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Must range be selected before a paste can be done?
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 "MichaelDavid" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Must range be selected before a paste can be done?
Use one line:
With ActiveSheet Range("A315:A999").Cut Range("A300") Range("C315:C999").Cut Range("C300") End With "MichaelDavid" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Must range be selected before a paste can be done?
Forgot the dots.
With ActiveSheet .Range("A315:A999").Cut Range("A300") .Range("C315:C999").Cut Range("C300") End With "JLGWhiz" wrote in message ... Use one line: With ActiveSheet Range("A315:A999").Cut Range("A300") Range("C315:C999").Cut Range("C300") End With "MichaelDavid" wrote in message ... 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Must range be selected before a paste can be done?
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 "JLGWhiz" wrote: Forgot the dots. With ActiveSheet .Range("A315:A999").Cut Range("A300") .Range("C315:C999").Cut Range("C300") End With "JLGWhiz" wrote in message ... Use one line: With ActiveSheet Range("A315:A999").Cut Range("A300") Range("C315:C999").Cut Range("C300") End With "MichaelDavid" wrote in message ... 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Must range be selected before a paste can be done?
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 "FSt1" wrote: 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 "MichaelDavid" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste selected Range from Excel to Outlook with Disclaimer Statement & Signature | Excel Discussion (Misc queries) | |||
Looping: Search Range in Multiple Selected Worksheets, Copy/Paste | Excel Programming | |||
Paste under selected cell | Excel Discussion (Misc queries) | |||
Context Menu, Paste Special From Selected Range | Excel Programming | |||
How to Copy & Paste selected Range in Excel (MFC) | Excel Programming |