Excel VBA Select Method - de-selecting pasted cells

KerryFSA

New Member
Joined
Dec 5, 2018
Messages
49
I have a 100x100 spreadsheet to which I paste data from another workbook using a macro. After the paste has been carried out, the entire recipient WS is shaded (selected). I would like to select a single cell in this WS so that the entire WS is not left selected. Here's the code I have tried, for which I get the error "Select method of range class failed" (1004). ("Sh" is a string that id's the sheet to be used in WB B; e.g. Sheet6.)

Rng1.Copy ' from WB A
Rng1P.PasteSpecial xlPasteValuesAndNumberFormats 'to WB B

Workbooks("WB B.xlsm").Sheets(Sh).Range("T4").Select
Application.CutCopyMode = False

Without the Select statement, the macro works just fine.
Even if I use something like:
Workbooks("WB B.xlsm").Sheets(Sh).Range("T4")=1

the macro will place a 1 in T4, but the whole sheet is still highlighted.
Is there another way to unselect the cells that have been pasted into WB B?

Thanks for your help, from a newbie.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
You cannot select a cell on any sheet unless it is the active sheet so you will have to do something like this:
Code:
Workbooks("WB B.xlsm").Sheets(Sh).Activate
Range("A1").Select
 
Upvote 0
You cannot select a cell on any sheet unless it is the active sheet so you will have to do something like this:
Code:
Workbooks("WB B.xlsm").Sheets(Sh).Activate
Range("A1").Select

Thank you Mumps. Worked well, of course.
Keep warm.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,210
Members
453,023
Latest member
alabaz

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