Select method of Range class failed

WallisAggie646777

New Member
Joined
May 6, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I did a record macro to copy a range of cells from one worksheet and paste into another worksheet which worked when recording the macro with my keystrokes.
When I put the code generated from the run macro into my code and try to execute it, and get the Select method of Range class failed error message. The code that fails is shown below.
There are no merged cells.
Sheets("Groups").Select
Range("O7:T32").Select 'THE ERROR OCCURS ON THIS LINE OF CODE
Application.CutCopyMode = False
Selection.Copy
Sheets("Temp").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Welcome to the Board!

Do you have any hidden rows or columns, or any protection going on?
Other than merged cells, those are the only other two things I can see would give you issues is trying to select a range.
 
Upvote 0
On top of what Joe has asked, where is the code located? Is it in a standard module, sheet mode, ThisWorkbook module, or somewhere else?
 
Upvote 0
Welcome to the Board!
On top of what Joe has asked, where is the code located? Is it in a standard module, sheet mode, ThisWorkbook module, or somewhere else?
The code is in the "Weekly" worksheet mode

Do you have any hidden rows or columns, or any protection going on?
Other than merged cells, those are the only other two things I can see would give you issues is trying to select a range.
 
Upvote 0
The code is in the "Weekly" worksheet mode
Then you need to change
VBA Code:
Range("O7:T32").Select
to
VBA Code:
Sheets("Groups").Range("O7:T32").Select

or avoid the selecting altogether
VBA Code:
Sheets("Groups").Range("O7:T32").Copy
Sheets("Temp").Range("A1").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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