+ Reply to Thread
Results 1 to 11 of 11

List Box Value Problem

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    texas
    MS-Off Ver
    Excel 2010
    Posts
    68

    List Box Value Problem

    Hi folks,

    I'm not picking up the value as I cycle thru a List box.
    Here's the code.

    Please Login or Register  to view this content.
    The list box is bound to column 4 where the total resides, but I'm getting a Null for the value.
    After the sub runs I can do this:

    Please Login or Register  to view this content.
    Here I get the value expected.

    How did I mess this up?

    thanks

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,018

    Re: List Box Value Problem

    Why are you trying to get a total by adding values from a list box instead of the actual cells?
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    texas
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: List Box Value Problem

    It seemed so simple to do it this way, the data in the list box is gathered from a dozen sheets.
    The userform is where the info is consolidated and displayed to the user as a report with different options available to select.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,018

    Re: List Box Value Problem

    You have:
    Call YTDActualFill 'Fill the List Box
    That indicates that you have a loop that's accessing only a single cell in several sheets. The code should total the variable as you progress through the loop rather than loading the values into a listbox.. You should show the code for YTDActualFill and post a sample workbook with several of the sheets being totaled.

  5. #5
    Registered User
    Join Date
    01-29-2013
    Location
    texas
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: List Box Value Problem

    The loop accesses 9 cells each on 12 sheets, I did however sum the total during the loop so I could get on with it. I still don't understand why the code I posted doesn't pick up the values of a bound column. Any ideas on that?

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551
    Try
    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,018

    Re: List Box Value Problem

    Please Login or Register  to view this content.
    Note that the index of the first item in the list is ZERO, not 1. See Mike7942 above. As it is you will miss the first and crash at .ListCount since the last item is # ListCount-1. Still, it's a bad idea...

  8. #8
    Registered User
    Join Date
    01-29-2013
    Location
    texas
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: List Box Value Problem

    Please Login or Register  to view this content.
    This info is as if the bound column = 1

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,018

    Re: List Box Value Problem

    You should post a sample workbook so we can stop guessing.
    To Attach a Workbook:
    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit

  10. #10
    Registered User
    Join Date
    01-29-2013
    Location
    texas
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: List Box Value Problem

    No luck getting permission to upload.

  11. #11
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,018

    Re: List Box Value Problem

    What was the error message? Is the file larger than 1MB (must be les)?

+ 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