+ Reply to Thread
Results 1 to 13 of 13

VBA Userform combobox rowsource and folder value help

  1. #1
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    VBA Userform combobox rowsource and folder value help

    I have tried looking around here for the answer to my problems but no luck.

    I am looking to do two different things....

    Firstly, I am simply trying to populate a combobox based on a range in a specified workbook at a different location (I don't want the workbook to have to be open) for example I need the ranges of B5:B41,D5:D40 and F5:F45 of the workbook WC.xls located at C:/WC.xls all compiled into this combobox.


    Secondly I am looking for my userform to automatically populate the next number that would come along in a series of file names at a specified location (for example, a folder full of files named ABC1, ABC2, ABC3, ABC4, and ABC5, I would need for the code to produce the number 6 (since that is the next number I would need the file name for)).


    Any help or direction would be greatly appreciated!

    ---------- Post added at 09:46 AM ---------- Previous post was at 08:14 AM ----------

    and also protect cells but only allow the userform to enter data?

    ---------- Post added at 12:26 PM ---------- Previous post was at 10:46 AM ----------

    anything will help...
    Last edited by ds16; 07-30-2012 at 10:07 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Userform combobox rowsource and folder value help

    To populate form another workboo the simplest method is probably to open the workbook, grab the data then close. Hide this action by switching off ScreenUpdating

    Your code would need to couunt the number of files in the folder, assumung they are all named like this.

    Protect with UserInterface is the best way to allow the userform to interact with the worksheet
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    thanks for the link

    any chance you have what the code would be like for the first two things? Still new to VBA so translating what I want to do into the syntax to do it is hard for me.

    ---------- Post added at 02:59 PM ---------- Previous post was at 01:24 PM ----------

    got the protect cells down
    Last edited by Cutter; 07-23-2012 at 02:30 PM. Reason: Removed whole post quote

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Userform combobox rowsource and folder value help

    Something like this

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    that looks good but when I try to run it it gets a run time error 438 (object doesn't support this property or method)

    I changed the destinations to the right places let me know if I did something wrong...(MASTER should be changed to sheet name?)

    Please Login or Register  to view this content.
    that has end sub and initialize sub in it as well...

    also do you have any code for the file number issue I have?

    thanks for the help!

  6. #6
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    up for more suggestions

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Userform combobox rowsource and folder value help

    Where is the code erroring?

    Try

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    Roy,

    here is my updated code

    Please Login or Register  to view this content.
    the first line that causes an error when using step into is
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    also any help on the number generating from a folder full of files would be greatly appreciated...that is probably more important than populating the combobox

  10. #10
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    up for exposure

  11. #11
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    heres my workbook if anyone is interested
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    solved the file search problem along with some great help

    here is my code if anyone is curious

    Please Login or Register  to view this content.
    if anyone is interested in what that did it searched the NCR folder for file names with NCR#### and returned the #### (and added 1) into my textbox1
    Last edited by ds16; 07-27-2012 at 09:25 AM.

  13. #13
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: VBA Userform combobox rowsource and folder value help

    up for more suggestions

+ 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