Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Copy / Paste Easy

I am trying to do a simple Copy/Paste

cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total",
LookAt:=xlWhole).Row

I want to copy "D" &clastrow+1: "D"&clastrow+17 to E+clastrow+1:
clastcol-5&clastrow+1
(In other words... D172:D192 to e172:ca192)

My sad attempt at code below:



Range("D" & cLastRow + 1 & ":" & "D" & cLastRow + 17).Copy
Range(Columns(cLastRow + 1, cLastcol - 5))

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copy / Paste Easy

cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total", LookAt:=xlWhole).Row

with worksheets("initial by Laser")
.range(.cells(cLastrow+1,"D"),.cells(clastrow+17," D")).copy _
destination:=.cells(clastrow+1,"E")
end with

Excel will resize the destination range to match the size of the copied range.

All this is happening on the "initial by laser" worksheet, right?


willwonka wrote:

I am trying to do a simple Copy/Paste

cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total",
LookAt:=xlWhole).Row

I want to copy "D" &clastrow+1: "D"&clastrow+17 to E+clastrow+1:
clastcol-5&clastrow+1
(In other words... D172:D192 to e172:ca192)

My sad attempt at code below:

Range("D" & cLastRow + 1 & ":" & "D" & cLastRow + 17).Copy
Range(Columns(cLastRow + 1, cLastcol - 5))


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Copy / Paste Easy

I'm not sure I see how the copies it out to Column CA?

Dave Peterson wrote:
cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total", LookAt:=xlWhole).Row

with worksheets("initial by Laser")
.range(.cells(cLastrow+1,"D"),.cells(clastrow+17," D")).copy _
destination:=.cells(clastrow+1,"E")
end with

Excel will resize the destination range to match the size of the copied range.

All this is happening on the "initial by laser" worksheet, right?


willwonka wrote:

I am trying to do a simple Copy/Paste

cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total",
LookAt:=xlWhole).Row

I want to copy "D" &clastrow+1: "D"&clastrow+17 to E+clastrow+1:
clastcol-5&clastrow+1
(In other words... D172:D192 to e172:ca192)

My sad attempt at code below:

Range("D" & cLastRow + 1 & ":" & "D" & cLastRow + 17).Copy
Range(Columns(cLastRow + 1, cLastcol - 5))


--

Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copy / Paste Easy

I misunderstood.

How about:

With Worksheets("initial by Laser")
.Range(.Cells(clastrow + 1, "D"), .Cells(clastrow + 17, "D")).Copy _
Destination:=.Range(.Cells(clastrow + 1, "E"), .Cells(clastrow + 17, "Ca"))
End With



willwonka wrote:

I'm not sure I see how the copies it out to Column CA?

Dave Peterson wrote:
cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total", LookAt:=xlWhole).Row

with worksheets("initial by Laser")
.range(.cells(cLastrow+1,"D"),.cells(clastrow+17," D")).copy _
destination:=.cells(clastrow+1,"E")
end with

Excel will resize the destination range to match the size of the copied range.

All this is happening on the "initial by laser" worksheet, right?


willwonka wrote:

I am trying to do a simple Copy/Paste

cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total",
LookAt:=xlWhole).Row

I want to copy "D" &clastrow+1: "D"&clastrow+17 to E+clastrow+1:
clastcol-5&clastrow+1
(In other words... D172:D192 to e172:ca192)

My sad attempt at code below:

Range("D" & cLastRow + 1 & ":" & "D" & cLastRow + 17).Copy
Range(Columns(cLastRow + 1, cLastcol - 5))


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Copy / Paste Easy

Worked great .. thanks.
I did replcace "Ca" with cLastCol for it to be more dynamic..
Thanks again.


Dave Peterson wrote:
I misunderstood.

How about:

With Worksheets("initial by Laser")
.Range(.Cells(clastrow + 1, "D"), .Cells(clastrow + 17, "D")).Copy _
Destination:=.Range(.Cells(clastrow + 1, "E"), .Cells(clastrow + 17, "Ca"))
End With



willwonka wrote:

I'm not sure I see how the copies it out to Column CA?

Dave Peterson wrote:
cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total", LookAt:=xlWhole).Row

with worksheets("initial by Laser")
.range(.cells(cLastrow+1,"D"),.cells(clastrow+17," D")).copy _
destination:=.cells(clastrow+1,"E")
end with

Excel will resize the destination range to match the size of the copied range.

All this is happening on the "initial by laser" worksheet, right?


willwonka wrote:

I am trying to do a simple Copy/Paste

cLastcol = Sheets("Initial by Laser").UsedRange.Columns.Count
cLastRow = Columns("A:A").Find(What:="Grand Total",
LookAt:=xlWhole).Row

I want to copy "D" &clastrow+1: "D"&clastrow+17 to E+clastrow+1:
clastcol-5&clastrow+1
(In other words... D172:D192 to e172:ca192)

My sad attempt at code below:

Range("D" & cLastRow + 1 & ":" & "D" & cLastRow + 17).Copy
Range(Columns(cLastRow + 1, cLastcol - 5))

--

Dave Peterson


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy eay to copy / paste a formula in column watermt Excel Worksheet Functions 2 November 17th 09 03:22 PM
Copy/Paste cell down to next value- Easy question, can't figure it J. Catz. Excel Discussion (Misc queries) 2 November 4th 09 10:45 AM
date copy paste should be very easy berk Excel Discussion (Misc queries) 3 August 23rd 07 10:50 AM
fairly easy (i thought) copy and paste cells, increment by 17 accross swatsp0p Excel Discussion (Misc queries) 1 May 25th 05 07:55 PM
fairly easy (i thought) copy and paste cells, increment by 17 accross bleugh Excel Discussion (Misc queries) 0 May 25th 05 06:27 PM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"