+ Reply to Thread
Results 1 to 7 of 7

Macro to select File within Folder

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,709

    Macro to select File within Folder

    I have the following code below to open a workbook & to copy the data


    The code works perfectly, but I need it amended to select the workbook starting with "Southern" in C:\Sales Reports\ for eg Southern Sales Data for Sept 2021.xlsm



    Please Login or Register  to view this content.

    Your assistance in amending my code is most appreciated

  2. #2
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro to select File within Folder

    Hi
    Try to change this part
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,709

    Re: Macro to select File within Folder

    Thanks for the help. I have incorporated your code, but the workbook containing "Southern" is not selected. The Folder displays all the workbooks for me to select

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro to select File within Folder

    Then try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,709

    Re: Macro to select File within Folder

    Thanks for the help. I now get invalid procedure call or argument


    The code below is highlighted

    Please Login or Register  to view this content.
    I have no idea what could be causing this

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Macro to select File within Folder

    Wildcards only work for the extensions.

    Try something like this instead.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,709

    Re: Macro to select File within Folder

    Thanks for the help bakerman2. Your code works perfectly

+ 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. Vba save csv file but ask for file name or select file name from folder
    By Grahamfeeley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2017, 12:30 AM
  2. Pop up box to select file - from specific folder
    By terratushi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2017, 05:55 AM
  3. [SOLVED] How to select a file instead of selecting the file's destination path/folder
    By dedark05 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-30-2016, 10:17 PM
  4. Replies: 0
    Last Post: 11-20-2014, 03:18 AM
  5. Select a file or folder
    By yossel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2014, 06:17 PM
  6. [SOLVED] Modify existing code to select file instead of select folder
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2014, 09:41 AM
  7. Macro asking to select the folder and open file.
    By lalaarif1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-04-2013, 04:03 PM

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