ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Not using select for copy and paste (https://www.excelbanter.com/excel-discussion-misc-queries/138270-not-using-select-copy-paste.html)

damorrison

Not using select for copy and paste
 
Hi,

How could I use this code without the select??

Sheets("Recovered_Sheet1").Select
Range("A10").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Copy
Sheets("New Format").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False


Dave Peterson

Not using select for copy and paste
 
Maybe...

Dim FirstCell as range
dim LastCell as range
dim RngToCopy as range

with worksheets("recovered_sheet1")
set firstcell = .range("a10")
set lastcell = firstcell.cells.specialcells(xlcelltypelastcell)
set rngtocopy = .range(firstcell,lastcell)
end with

rngtocopy.copy _
destination:=worksheets("new format").range("a2")

application.cutcopymode = false



damorrison wrote:

Hi,

How could I use this code without the select??

Sheets("Recovered_Sheet1").Select
Range("A10").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Copy
Sheets("New Format").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False


--

Dave Peterson

damorrison

Not using select for copy and paste
 
Thank you very much



All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com