Results 1 to 5 of 5

Pull Data from One Sheet to Another

Threaded View

  1. #1
    Registered User
    Join Date
    12-21-2011
    Location
    South Florida
    MS-Off Ver
    MS 2010
    Posts
    6

    Pull Data from One Sheet to Another

    Hi Folks,
    I am trying to create a macro that will pull some data from different cells in one worksheet and posting it to another worksheet within the same workbook. I am trying to get my head around coding this (total Excel noob here) but having a heck of a time.
    If someone can take a look at what I have and let me know what I am doing wrong, I would greatly apreciate it.
    Thanks.

    Sub DatabaseTest
    '
    ' DatabaseTest Macro
    '
    
    '
    Dim wsSource As Worksheet, wsDest As Worksheet
        Dim Nextrow As Long
        
        Set wsSource = Sheets("Purchase")
        Set wsDest = Sheets("Sheet1")
        
        ' Next empty row on the destination worksheet
        Nextrow = wsDest.Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
    
        ' Date
        wsDest.Range("A2" & Nextrow).Value = wsSource.Range("L1").Value
        ' Ticket
        wsDest.Range("B2" & Nextrow).Value = wsSource.Range("L3").Value
        ' Client
        wsDest.Range("C2" & Nextrow).Value = wsSource.Range("D2").Value
        ' Steel Spot
        wsDest.Range("D2" & Nextrow).Value = wsSource.Range("F8").Value
        ' Steel Weight
        wsDest.Range("E2" & Nextrow).Value = wsSource.Range("E20").Value
        ' Steel Total
        wsDest.Range("F2" & Nextrow).Value = wsSource.Range("G20").Value
        ' Copper Spot
        wsDest.Range("G2" & Nextrow).Value = wsSource.Range("F22").Value
        ' Copper Weight
        wsDest.Range("H2" & Nextrow).Value = wsSource.Range("E28").Value
        ' Copper Total
        wsDest.Range("I2" & Nextrow).Value = wsSource.Range("G28").Value
        ' Aluminum Spot
        wsDest.Range("J2" & Nextrow).Value = wsSource.Range("F30").Value
        ' Aluminum Weight
        wsDest.Range("K2" & Nextrow).Value = wsSource.Range("E40").Value
        ' Aluminum Total
        wsDest.Range("L2" & Nextrow).Value = wsSource.Range("G40").Value
        ' Total Purchase
        wsDest.Range("M2" & Nextrow).Value = wsSource.Range("G41").Value
        
        
    
       
    End Sub
    Attached Files Attached Files
    Last edited by FourNines; 12-29-2011 at 10:34 AM. Reason: Solved-Thanks.

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