+ Reply to Thread
Results 1 to 3 of 3

what is the vb code to copy rows from one sheet to another?

  1. #1
    Registered User
    Join Date
    03-16-2006
    Posts
    38

    what is the vb code to copy rows from one sheet to another?

    Can someone please help tell me what is the correct syntax/ie vb code
    to copy a entire row from one sheet to another?

    Pretend I have two sheets and want to copy an entire row from sheet2
    to sheet one , what is the code to do something like this?

    I know I can do it manually, but for what I am doing I need
    the macro code to do it automatically.

    Thanks

  2. #2
    Ardus Petus
    Guest

    Re: what is the vb code to copy rows from one sheet to another?

    If you cant to copy everything (including formats):

    Worksheets("Sheet2").Rows(10).Copy _
    dest:=Worksheets("Sheet1").rows(10)

    To copy values only:
    Worksheets("Sheet1").rows(10).value = _
    Worksheets("Sheet2").Rows(10).Value

    HTH
    --
    AP

    "bxc2739" <[email protected]> a écrit
    dans le message de news:
    [email protected]...
    >
    > Can someone please help tell me what is the correct syntax/ie vb code
    > to copy a entire row from one sheet to another?
    >
    > Pretend I have two sheets and want to copy an entire row from sheet2
    > to sheet one , what is the code to do something like this?
    >
    > I know I can do it manually, but for what I am doing I need
    > the macro code to do it automatically.
    >
    > Thanks
    >
    >
    > --
    > bxc2739
    > ------------------------------------------------------------------------
    > bxc2739's Profile:
    > http://www.excelforum.com/member.php...o&userid=32538
    > View this thread: http://www.excelforum.com/showthread...hreadid=545604
    >




  3. #3
    Dave Peterson
    Guest

    Re: what is the vb code to copy rows from one sheet to another?

    You gonna be pasting at the bottom of a group of rows???

    Can you pick out a column that has data in it if that row is used?

    dim myCell as range
    dim NextRow as long
    dim DestCell as range

    with worksheets("sheet1")
    set mycell = .range("b72") 'some cell
    end with

    with worksheets("sheet2")
    nextrow = .cells(.rows.count,"G").end(xlup).row + 1
    set destcell = .cells(nextrow,"A")
    end with

    mycell.entirerow.copy _
    destination:=destcell



    bxc2739 wrote:
    >
    > Can someone please help tell me what is the correct syntax/ie vb code
    > to copy a entire row from one sheet to another?
    >
    > Pretend I have two sheets and want to copy an entire row from sheet2
    > to sheet one , what is the code to do something like this?
    >
    > I know I can do it manually, but for what I am doing I need
    > the macro code to do it automatically.
    >
    > Thanks
    >
    > --
    > bxc2739
    > ------------------------------------------------------------------------
    > bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
    > View this thread: http://www.excelforum.com/showthread...hreadid=545604


    --

    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