VBA Cut/Paste

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,113
Office Version
  1. 365
Platform
  1. Windows
Good Day All,

I'm trying to Cut/Paste:

VBA Code:
    Range("AU6:CM36").Select
    Selection.Cut
    Range("B78").Select
    Selection.Paste

But I'm getting an error message:

Capture2.PNG


Also, does anyone know why?

Also, Also, does anyone know how to paste values after a Cut?

Please let me know.

Thank you!
pinaceous
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi.
Try replacing Selection.Paste by ActiveSheet.Paste

Or just
VBA Code:
Range("AU6:CM36").Cut Range("B78")
 
Upvote 1
What about just this instead of those 4 lines of code?

VBA Code:
Range("AU6:CM36").Cut Range("B78")

:oops: Oops, @Osvaldo Palmeiro already suggested that
 
Upvote 0
how to paste values after a Cut?
You can't do that one step. The simplest is probably this:
VBA Code:
Sub Cut_Paste()
    With Range("AU6:CM36")
        .Copy
        Range("B78").PasteSpecial xlPasteValues
        Range("B78").PasteSpecial xlPasteFormats    ' Cut and paste brings over the formatting
        .Clear                                      ' Use .ClearContents if you want to leave the formatting in the original range
    End With
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,216,009
Messages
6,128,258
Members
449,435
Latest member
Jahmia0616

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top