+ Reply to Thread
Results 1 to 10 of 10

Buttons to prompt for directroy. Paste directory location in corresponding cell.

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Buttons to prompt for directroy. Paste directory location in corresponding cell.

    I have a worksheet where I need a series of 10 buttons the user can click and specify a folder location for each. The location then needs to be pasted in the corresponding cell to the right of the button.

    - - A - B
    1 - "Button" - File location 1 returned from button A1
    2 - "Button" - File location 2 returned from button A2
    3 - "Button" - File location 3 returned from button A3
    4 - "Button" - File location 4 returned from button A4
    5 - "Button" - File location 5 returned from button A5
    6 - "Button" - File location 6 returned from button A6
    7 - "Button" - File location 7 returned from button A7
    8 - "Button" - File location 8 returned from button A8
    9 - "Button" - File location 9 returned from button A9
    10 - "Button" - File location 10 returned from button A10


    I found the below code which brings up the folder dialog box. I can't figure out how to paste the folder location in to the corresponding cell. Thanks for the help!

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 06-27-2013 at 07:14 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Hello mamero,

    What type of buttons are these/ Are they Forms buttons or ActiveX?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Thanks for the quick response. I am using form buttons. Would it be better with ActiveX buttons?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Hello mamero,

    Form buttons are fine. It would help to see the worksheet. Can you post your workbook?

    To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

    File Manger Picture

  5. #5
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Folder Test.xlsm

    Please see attached. Thanks.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Hello mamero,

    Thanks for posting the workbook. The positioning of the Button within the cell is critical to the macro workiing correctly. You did an excellent job with these buttons. Here is the macro that has been assigned to each button...
    Please Login or Register  to view this content.
    [/QUOTE]
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    This is a good start. It works well for populating the cell based on what the user inputs. The challenge is it requires the user to manually type in the full directory. Is it possible to combine your method with the original script? I need a "Browse" window to open that allows the user to browse their computer and select a directory. Thanks.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Hello mamero,

    Sorry, I got side tracked. here is the code with the browse for folder feature. Just replace the code. No need to reassign the macro to each button.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    That's perfect! I just had to pull out:

    FolderPath = InputBox("Enter the folder's path below.")

    It was bringing up both windows. Thank you very much for your assistance!

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Buttons to prompt for directroy. Paste directory location in corresponding cell.

    Hello mamero,

    You're welcome.

+ 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