Results 1 to 4 of 4

How do you reference a variable file in VBA?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    How do you reference a variable file in VBA?

    How can I reference Sheet2 of my opened file?

    Currently I have a macro that finds the most recent file in a folder and opens it. If I wanted to do a calculation based on a column in Sheet 2 of the newly opened file, how would I reference this file in VBA? I cannot use the file name to call it since the file name will change (each time I run the macro, the most recent file is opened). For example, if I run the macro this week, the file name "12-7 Reports" is opened, but if I run it next week, the file "12-14 Reports is opened"
    Last edited by Sgligori; 12-10-2015 at 12:13 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. File reference containing variable - is it possible?
    By AwelStaw in forum Excel General
    Replies: 1
    Last Post: 04-09-2013, 06:46 PM
  2. Variable File Reference and Variable Table Array in VBA VLOOKUP
    By Gingeiko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2011, 11:08 PM
  3. variable file reference
    By johndough185 in forum Excel General
    Replies: 5
    Last Post: 11-01-2007, 09:48 AM
  4. [SOLVED] Making a file and worksheet reference into a variable....
    By Bernard Liengme in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] Making a file and worksheet reference into a variable....
    By Mr Mike in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2005, 04:05 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