Consulting

Results 1 to 2 of 2

Thread: Excel VBA to cut & paste between worksheets

  1. #1
    VBAX Regular
    Joined
    Dec 2009
    Posts
    28
    Location

    Excel VBA to cut & paste between worksheets

    Hi I'm using Excel 2003 with VBA at work to do a small project.
    Ive created userform to enter 10 fields of data into a spreeddheet(named CalloutLog) Using comboboxs textboxs etc. That all works really well all of the entries appear in the spreedsheet "CalloutLog" .

    Now I would like to have a commandbutton on "CalloutLog" so when all the entries have been made for that week. The button can be clicked and all of those entries are cut and pasted (or otherwise transferred) appended to the bottom of a worksheet named MasterCalloutLog in another workbook (note must not overwrite exiting MasterCalloutLog data) and a messagebox to popup and inform the user that the data has been transferred successfully.

    So CalloutLog sheet that the person entered the data into originally is now blank except for the header row and all the data now resides in the MasterCalloutLog. Where our engineer can make his pretty charts from it.

    Thakyou
    Last edited by PeterNZ; 12-27-2009 at 04:10 PM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Something like this?

    [vba]

    Dim LastRow As Long
    Dim NextRow As Long

    With Worksheets("MasterCalloutLog")

    NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
    End With

    With Worksheets("CalloutLog")

    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    .Rows(2).Resize(LastRow -1).Copy Worksheets("MasterCalloutLog").Cells(NextRow, "A")
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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