+ Reply to Thread
Results 1 to 2 of 2

open variably named file, copy/paste data into consolidation file, open next file in list

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    open variably named file, copy/paste data into consolidation file, open next file in list

    Hello,

    This is my first post, and I know enough about macros/VBA to be dangerous (i.e. write simple macros) but not enough to use variables, named ranges, etc. effectively!

    I have a set of files, each of which is similarly named, and I want to open one, copy data from a pivot table on a tab that is identically named in each file, and paste the data into a "consolidation" file from which I'm running the macro, close the file and open next one.

    I listed the variable part of the file name in one column of the “consolidation” file, and I think I have the code right to open a file, copy the data, but my issues are:
    1) I get an error selecting the named range (a variable) in which to paste the data, (at this point I get the error “Run-time error ’1004’: Method ‘Range’ of object ‘_Global’ failed”
    2) switching back and forth between the "consolidation" file and the file with the data appears to work, but sometimes the data file opens yet does not become the active workbook, and that makes the rest of the code not work.

    Any help you can offer would be greatly appreciated!

    Thanks,
    Stacey


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Cutter; 08-29-2012 at 09:48 PM. Reason: Added code tags

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: open variably named file, copy/paste data into consolidation file, open next file in l

    @ sllawrence1968

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

+ Reply to Thread

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