+ Reply to Thread
Results 1 to 4 of 4

Copy entire columns starting from a certain cell down

  1. #1
    cheeser83
    Guest

    Copy entire columns starting from a certain cell down

    I need a code that will copy an entire column, such as column A, but
    not starting in cell A1. I would like to copy all cells beginning in
    A7 down to the last cell used in column A and then I will paste to a
    different sheet. I will be doing this with several different columns,
    not just column A, but all columns will start and end in the same rows,
    but the number of rows used will vary from month to month. I may have
    10 rows one month, but 1000 the next.

    Any help is much appreciated!


  2. #2
    Tom Ogilvy
    Guest

    RE: Copy entire columns starting from a certain cell down

    This copies columns A, G, I , V


    Dim v as Variant, col as Long
    v = Array(0,6,8,21) ' A, G, I, V
    col = 1
    set rng = Range(Cells(7,1),Cells(rows.count,1).End(xlup))
    for i = lbound(v) to ubound(v)
    rng.offset(,v(i)).copy Destination:= _
    worksheets("sheet2").Cells(1,col)
    col = col + 1
    Next


    --
    Regards,
    Tom Ogilvy



    "cheeser83" wrote:

    > I need a code that will copy an entire column, such as column A, but
    > not starting in cell A1. I would like to copy all cells beginning in
    > A7 down to the last cell used in column A and then I will paste to a
    > different sheet. I will be doing this with several different columns,
    > not just column A, but all columns will start and end in the same rows,
    > but the number of rows used will vary from month to month. I may have
    > 10 rows one month, but 1000 the next.
    >
    > Any help is much appreciated!
    >
    >


  3. #3
    cheeser83
    Guest

    Re: Copy entire columns starting from a certain cell down

    Thank you for the code. I am trying to decipher it as best I can. I
    have a medium understanding of VBA. What part of the code is telling
    it where to paste? I would like to be able to change it to paste in a
    different area. For example, what it copies our of column A on sheet
    1, I want to paste it to column B starting in row 7.

    Thank you very much for your help.


    Tom Ogilvy wrote:
    > This copies columns A, G, I , V
    >
    >
    > Dim v as Variant, col as Long
    > v = Array(0,6,8,21) ' A, G, I, V
    > col = 1
    > set rng = Range(Cells(7,1),Cells(rows.count,1).End(xlup))
    > for i = lbound(v) to ubound(v)
    > rng.offset(,v(i)).copy Destination:= _
    > worksheets("sheet2").Cells(1,col)
    > col = col + 1
    > Next
    >
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "cheeser83" wrote:
    >
    > > I need a code that will copy an entire column, such as column A, but
    > > not starting in cell A1. I would like to copy all cells beginning in
    > > A7 down to the last cell used in column A and then I will paste to a
    > > different sheet. I will be doing this with several different columns,
    > > not just column A, but all columns will start and end in the same rows,
    > > but the number of rows used will vary from month to month. I may have
    > > 10 rows one month, but 1000 the next.
    > >
    > > Any help is much appreciated!
    > >
    > >



  4. #4
    Tom Ogilvy
    Guest

    Re: Copy entire columns starting from a certain cell down

    Dim v as Variant, col as Long
    v = Array(0,6,8,21) ' A, G, I, V
    col = 2 '<================= specify first column
    set rng = Range(Cells(7,1),Cells(rows.count,1).End(xlup))
    for i = lbound(v) to ubound(v)
    rng.offset(,v(i)).copy Destination:= _
    worksheets("sheet2").Cells(7,col) '<== row 7
    col = col + 1
    Next


    --
    Regards,
    Tom Ogilvy

    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > This copies columns A, G, I , V
    >
    >
    > Dim v as Variant, col as Long
    > v = Array(0,6,8,21) ' A, G, I, V
    > col = 1
    > set rng = Range(Cells(7,1),Cells(rows.count,1).End(xlup))
    > for i = lbound(v) to ubound(v)
    > rng.offset(,v(i)).copy Destination:= _
    > worksheets("sheet2").Cells(1,col)
    > col = col + 1
    > Next
    >
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "cheeser83" wrote:
    >
    >> I need a code that will copy an entire column, such as column A, but
    >> not starting in cell A1. I would like to copy all cells beginning in
    >> A7 down to the last cell used in column A and then I will paste to a
    >> different sheet. I will be doing this with several different columns,
    >> not just column A, but all columns will start and end in the same rows,
    >> but the number of rows used will vary from month to month. I may have
    >> 10 rows one month, but 1000 the next.
    >>
    >> Any help is much appreciated!
    >>
    >>




+ 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