+ Reply to Thread
Results 1 to 2 of 2

Insert a row then copy a transaction

  1. #1
    Registered User
    Join Date
    07-13-2005
    Posts
    89

    Insert a row then copy a transaction

    Hello gurus,

    Can somebody show me how to create a macro/script that would insert a row in a worksheet (Sheet1) and then copy the top row of another worksheet (Sheet2) into the inserted row? The copying needs to triggered manually.

    We have a 4 copy pre-printed form that we use a dot matrix to print to it and I made an Excel template where the clerk can enter the data and then just hit print. I am trying to capture the data that the clerk types in and create a database so we'll a searchable computer record.

    If inserting the data in a row is not possible, how about exporting a row and appending it on a text file?

    Thanks in advance.

  2. #2
    Rowan
    Guest

    RE: Insert a row then copy a transaction

    You didn't say where you want to insert the row but I have assumed at row 2
    (just below headings).

    Sub CopyOver()
    Sheets("Sheet1").Range("A2").EntireRow.Insert
    Sheets("Sheet2").Rows("1:1").Copy _
    Destination:=Sheets("Sheet1").Rows("2:2")
    End Sub

    Alternately, you may just want to copy the data to the first row which does
    not allready have data in column A (i.e. the first blank row):

    Sub CopyOver()
    Dim endRow As Long
    endRow = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row + 1
    Sheets("Sheet2").Rows("1:1").Copy _
    Destination:=Sheets("Sheet1").Rows(endRow & ":" & endRow)
    End Sub

    Hope this helps
    Rowan


    "ledzepe" wrote:

    >
    > Hello gurus,
    >
    > Can somebody show me how to create a macro/script that would insert a
    > row in a worksheet (Sheet1) and then copy the top row of another
    > worksheet (Sheet2) into the inserted row? The copying needs to
    > triggered manually.
    >
    > We have a 4 copy pre-printed form that we use a dot matrix to print to
    > it and I made an Excel template where the clerk can enter the data and
    > then just hit print. I am trying to capture the data that the clerk
    > types in and create a database so we'll a searchable computer record.
    >
    > If inserting the data in a row is not possible, how about exporting a
    > row and appending it on a text file?
    >
    > Thanks in advance.
    >
    >
    > --
    > ledzepe
    > ------------------------------------------------------------------------
    > ledzepe's Profile: http://www.excelforum.com/member.php...o&userid=25207
    > View this thread: http://www.excelforum.com/showthread...hreadid=386957
    >
    >


+ 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