+ Reply to Thread
Results 1 to 3 of 3

Copy cell from one workbook to a specific cell in another workbook

Hybrid View

omhs.msa Copy cell from one workbook... 12-19-2013, 03:38 PM
alansidman Re: Copy cell from one... 12-19-2013, 03:54 PM
JOHN H. DAVIS Re: Copy cell from one... 12-19-2013, 03:55 PM
  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    maryland, usa
    MS-Off Ver
    Excel 2007
    Posts
    1

    Copy cell from one workbook to a specific cell in another workbook

    I have two different excel files. The first excel file, "Invoice" has information in specific cells that I want to copy over to a specific cell in another excel file, "Packing Slip."

    I want the information from "Invoice" B23:B45, F23:F45, and G23:G45 to copy to "Packing Slip" B23:B45, H23:H45, and J23:J45 when I click Submit.

    I tried doing one cell only to test try and came up with the following codes, but not even this works.

    HTML Code: 
    As well as this one:

    HTML Code: 

    None of them work. Can anyone help me please?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Copy cell from one workbook to a specific cell in another workbook

    Try this:

    Sub submit()
        Dim wbThis As Workbook
        Dim wbDest As Workbook
        Dim rng1 As Range
        Dim rng2 As Range
        Dim rng3 As Range
        Dim rng4 As Range
        Dim rng5 As Range
        Dim rng6 As Range
        Set wbThis = Workbooks("C:\Users\Invoice.xlsm")
        Set wbDest = Workbooks.Open("C:\Users\Packing Slip.xlsm")
        rng1 = wbThis.Sheets("Sheet1").Range("B23:B45")
        rng2 = wbThis.Sheets("Sheet1").Range("F23:F45")
        rng3 = wbThis.Sheets("Sheet1").Range("GF23:GF45")
        rng4 = wbDest.Sheets("Sheet1").Range("B23")
        rng5 = wbDest.Sheets("Sheet1").Range("H23")
        rng6 = wbDest.Sheets("Sheet1").Range("J23")
    rng4.Value = rng1.Value
    rng5.Value = rng2.Value
    rng6.Value = rng3.Value
    
    wbDest.Close
    
    End Sub
    Last edited by alansidman; 12-19-2013 at 03:58 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy cell from one workbook to a specific cell in another workbook

    This works for me:

    Sub omhs_msa()
    Workbooks.Open ("C:\Users\Packing Slip.xlsm")
    Workbooks("Packing Slip.xlsm").Sheets("PAGE 1").Range("B23:B45").Value = Workbooks("Invoice.xls").Sheets("PAGE 1").Range("B23:B45").Value
    Workbooks("Packing Slip.xlsm").Sheets("PAGE 1").Range("F23:F45").Value = Workbooks("Invoice.xls").Sheets("PAGE 1").Range("F23:F45").Value
    Workbooks("Packing Slip.xlsm").Sheets("PAGE 1").Range("G23:G45").Value = Workbooks("Invoice.xls").Sheets("PAGE 1").Range("G23:G45").Value
    Workbooks("Packing Slip.xlsm").Close True
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to copy specific cell data into a different excel workbook
    By Khanzaki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2013, 05:55 AM
  2. [SOLVED] Copy specific cell in various workbooks to another workbook, but in consequtive cells
    By andreroux in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-06-2013, 10:49 AM
  3. Replies: 1
    Last Post: 04-26-2013, 04:54 PM
  4. Copy from Extract in one workbook to specific cell range in other
    By Michelle Deigh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2013, 09:07 AM
  5. Copy specific cell(s) or named range from one workbook to another
    By gcoug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2012, 06:01 PM

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