+ Reply to Thread
Results 1 to 7 of 7

Open file-Copy data from and XLSX to xls document

  1. #1
    Forum Contributor
    Join Date
    07-17-2015
    Location
    Roanoke, Virginia
    MS-Off Ver
    2010
    Posts
    173

    Open file-Copy data from and XLSX to xls document

    Need a macro that
    opens a closed workbook
    file name: Zip to county to Region.xlsx
    file path C:\test\data

    I need to copy the worksheet "Zip to Region" to an open workbook named like Excessive*.xls
    Trying to copy the worksheet from xlsx to xls errors because of size diff. Changing xls to xlsx is not an option.
    The data on worksheet ZIp to county to Region is A1:C1500

    A new worksheet needs to be added to Excessive*.xls and the data copied onto it.
    The ZIp to county to Region.xlsx should remain open

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Open file-Copy data from and XLSX to xls document

    Try:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Open file-Copy data from and XLSX to xls document

    Hopefully, Olly's suggestion works for you.
    But here is a way to auto-convert your xlsx file to xls
    ChosenName does not require an extension.
    Amend myPath and myFile to match your requirements


    1. put code below in a general module in a workbook
    2. open file "Zip to county to Region.xlsx"
    3. run the code
    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Forum Contributor
    Join Date
    07-17-2015
    Location
    Roanoke, Virginia
    MS-Off Ver
    2010
    Posts
    173

    Re: Open file-Copy data from and XLSX to xls document

    Opens the workbook but doesn't copy data to open workbook named
    like "Excessive*.xls"

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Open file-Copy data from and XLSX to xls document

    Quote Originally Posted by 3345james View Post
    Opens the workbook but doesn't copy data to open workbook named
    like "Excessive*.xls"
    Are you putting (and running) the code in the "Excessive*" workbook, or in another workbook?

    If it's in another workbook, then we need to change this line:
    Please Login or Register  to view this content.
    You said the workbook is "named like Excessive*.xls"

    So try changing the code to:
    Please Login or Register  to view this content.
    I've highlighted the changes in red.

  6. #6
    Forum Contributor
    Join Date
    07-17-2015
    Location
    Roanoke, Virginia
    MS-Off Ver
    2010
    Posts
    173

    Re: Open file-Copy data from and XLSX to xls document

    Says no open file named Excessive
    I attached the file I'm using less data and also the Zip file
    The name on the zip changed but I changed in the macro before running

    Thanks for bearing with me

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Open file-Copy data from and XLSX to xls document

    No attachment?

+ 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. Replies: 3
    Last Post: 01-05-2014, 05:50 AM
  2. Replies: 4
    Last Post: 10-23-2013, 12:54 AM
  3. [SOLVED] Open an xlsx with most recent date in filename, run my data pulling macro, then move file
    By alanwu07 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2013, 05:24 AM
  4. [SOLVED] open variably named file, copy/paste data into consolidation file, open next file in list
    By sllawrence1968 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2012, 09:49 PM
  5. How to add the columns data of several xlsx files of a folder in another xlsx file
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-25-2012, 04:29 AM
  6. VBA for excel 2003. Open file dialog box, open 2007 file xlsx, continue with code
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2011, 12:12 AM
  7. Help: Open all xlsx files in dir, copy data from cells and paste in 1 master xlsm
    By dgibson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2011, 04:17 AM

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