+ Reply to Thread
Results 1 to 9 of 9

Copy / Paste Easy

Hybrid View

  1. #1
    willwonka
    Guest

    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. #2
    Dave Peterson
    Guest

    Re: 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. #3
    willwonka
    Guest

    Re: 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. #4
    Dave Peterson
    Guest

    Re: 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. #5
    willwonka
    Guest

    Re: 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



  6. #6
    willwonka
    Guest

    Re: 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



  7. #7
    willwonka
    Guest

    Re: 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



  8. #8
    willwonka
    Guest

    Re: 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



  9. #9
    willwonka
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1