Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Easy eay to copy / paste a formula in column | Excel Worksheet Functions | |||
Copy/Paste cell down to next value- Easy question, can't figure it | Excel Discussion (Misc queries) | |||
date copy paste should be very easy | Excel Discussion (Misc queries) | |||
fairly easy (i thought) copy and paste cells, increment by 17 accross | Excel Discussion (Misc queries) | |||
fairly easy (i thought) copy and paste cells, increment by 17 accross | Excel Discussion (Misc queries) |