Results 1 to 10 of 10

Transfer Cell Values from worksheets to a Master Workbook

Threaded View

sandy1977 Transfer Cell Values from... 12-24-2016, 12:52 AM
Trevor_S Re: Transfer Cell Values from... 12-24-2016, 01:16 PM
sandy1977 Re: Transfer Cell Values from... 12-24-2016, 01:31 PM
Trevor_S Re: Transfer Cell Values from... 12-24-2016, 01:47 PM
sandy1977 Re: Transfer Cell Values from... 12-24-2016, 02:09 PM
Trevor_S Re: Transfer Cell Values from... 12-24-2016, 02:22 PM
sandy1977 Re: Transfer Cell Values from... 12-24-2016, 02:34 PM
sandy1977 Re: Transfer Cell Values from... 12-24-2016, 02:40 PM
sandy1977 Re: Transfer Cell Values from... 12-24-2016, 02:36 PM
Trevor_S Re: Transfer Cell Values from... 12-24-2016, 02:39 PM
  1. #1
    Registered User
    Join Date
    08-23-2014
    Location
    Miami, USA
    MS-Off Ver
    365
    Posts
    69

    Transfer Cell Values from worksheets to a Master Workbook

    I'm a newbie to VBA and I need help trying to populate a Master Workbook from a Client Template Workbook that i fill out.

    So my idea is to transfer the data, by the press of a button, from two worksheets located in the Client Template document and populate "Sheet1" in the Master Workbook.

    Due to my lack of knowledge in VBA I got to the point where I can populate "Sheet1" of the Master Workbook but I trapped myself where I can´t use my VBA code to populate the next row of the Master document with a new client information.

    At the end I would like the Master Workbook to have a list of all my clients information; and if at all possible, if I revisit a Client's information and transfer its data to the Master Workbook, I would like for it to overwrite the current information, using the Client's Name as the reference.

    I'm pretty sure there is a better way to do this but here is my code:

    Sub copy_paste_non_adjacent_cells()
     
    Dim SourceSht As Worksheet
    Dim SourceSht2 As Worksheet
    Dim TargetSht As Worksheet
    Dim mydata As Workbook
    Dim pasteRange As Range
    
    Dim SourceRng As Variant
    Dim SourceRng2 As Variant
    Dim TargetRng As Variant
    Dim TargetRng2 As Variant
    Dim r As Long
    Dim i As Long
     
    
    Set SourceSht = ActiveSheet 'ActiveSheet is the Client Template Document
    Set mydata = Workbooks.Open("D:\Users\DMol\Desktop\ImportTest.xlsx") 'This is the path to my Master Workbook
    
    Set TargetSht = mydata.Worksheets("Sheet1") 'Master Workbook Sheet 1
    
    SourceRng = Array("B2", "B5", "B6", "B7", "B15", "B17", "B18", "B19", "B36", "B41", "B42", "B44", "B45")
    TargetRng = Array("A2", "B2", "C2", "D2", "E2", "F2", "G2", "H2", "I2", "J2", "K2", "L2", "M2")
     
        For i = LBound(SourceRng) To UBound(SourceRng)
        TargetSht.Range(TargetRng(i)) = SourceSht.Range(SourceRng(i))
        Next i
      
     ThisWorkbook.Activate 'Go back to Client Template WorkBook
     
     Set SourceSht2 = Worksheets("Sheet1") 'Look into Client Template "Sheet1"
     
     SourceRng2 = Array("L14", "L16", "K11", "L11", "M11", "N11", "O11", "P11", "Q11")
     TargetRng2 = Array("N2", "O2", "P2", "Q2", "R2", "S2", "T2", "U2", "V2")
     
     For i = LBound(SourceRng2) To UBound(SourceRng2)
        TargetSht.Range(TargetRng2(i)) = SourceSht2.Range(SourceRng2(i))
        Next i
      
    End Sub

    I have attached the two documents for reference. Thank you in advance
    Attached Files Attached Files
    Last edited by sandy1977; 12-24-2016 at 11:41 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Transfer data from multiple workbooks into Master workbook in SharePoint
    By faraha91 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2016, 05:58 AM
  2. [SOLVED] How to transfer specific row of data from multiple workbooks to master workbook using VBA
    By rajeshntiwari in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-08-2014, 08:08 AM
  3. Replies: 3
    Last Post: 01-10-2012, 06:58 PM
  4. Replies: 5
    Last Post: 09-20-2010, 04:58 PM
  5. Live Transfer a range of cell values to another Sheet or to another Workbook
    By phstol in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-10-2009, 12:00 PM
  6. Transfer values to master sheet
    By cdrwolfe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2008, 07:56 PM
  7. Transfer figures from workbook to master
    By neodjandre in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2007, 08:04 AM

Tags for this Thread

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