+ Reply to Thread
Results 1 to 3 of 3

Help with Userform Data Source for Listbox refrerencing using full path

  1. #1
    Registered User
    Join Date
    01-26-2014
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    13

    Help with Userform Data Source for Listbox refrerencing using full path

    I am learning VBA and to do this have a project.

    The userform listbox is sourced from a sheet within the open workbook that is to be hidden when project is complete (in about 6 yrs time at the going rate).

    I was working on sorting out the circular calls and how to prevent them e.g listindex = 0 so opened up a second workbook to put my notes in when running my project code in the other workbook when I realised that it could not populate the listbox as it was trying to read from the active workbook! Something I had not thought of!

    So, I decided I had better resolve the problem by ensuring that no matter how many spreadsheets the user has open, my code will always look to source the listbox from the project workbook which would of course be open too. Easypeasy thinks me, NOT!

    Please Login or Register  to view this content.
    Works fine until but changing it to

    Please Login or Register  to view this content.
    It is not accepting the named range. I think I am breaking one of rules of VBA by having .range after .worksheets but cannot work out what I should be doing instead?

    Any help/pointers in the right direction appreciated.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Help with Userform Data Source for Listbox refrerencing using full path

    Try this.
    Please Login or Register  to view this content.
    If that doesn't work the problem is with the named range, probably due to it's scope.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-26-2014
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Help with Userform Data Source for Listbox refrerencing using full path

    Thank you Norie,

    I tested the code and it works so, rather than use within each code referencing different ranges I started at the beginning of the subroutine using With ThisWorkbook and it works but not only that appears to have resolved another problem I had displaying the default value when user had not clicked or changed any options (I was using listindex = 0 which somehow produced a blank or null value)

    On to next stage

+ 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. Transfer Data From One Userform Listbox to Another Userform Listbox with 11 columns
    By sparkoft in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-18-2013, 10:54 AM
  2. [SOLVED] Allow User Change Data Source Path
    By Kburges in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2013, 05:17 PM
  3. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  4. Printing word document from full file path in textbox in userform
    By pharmsunil2010 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2010, 05:37 AM
  5. Replies: 7
    Last Post: 10-09-2009, 10:10 AM

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