+ Reply to Thread
Results 1 to 7 of 7

Userforms and Using ListBox Selection in a Formula

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Userforms and Using ListBox Selection in a Formula

    Apologies if similar questions have been posted before. I have looked all over for a solution and can't see the wood for the trees

    I have a workbook which contains a Summary Sheet, calculator and a worksheet for each month of the year.

    There is a Userform which is activated by pressing a button on the Summary Sheet.

    The Userform contains a ListBox (ListBox1) and a Run KPI button. The listbox allows the user to select any month from the list. When the button is pressed it will open up a separate report sheet and copy the data into the correct month's sheet (using the Listbox selection). It should then insert formulas into the Calculator sheet which reference to the correct month's worksheet.

    I am currently stuck on the formula as it doesn't seem to work the way I need:

    The Calculator has various cells which must be calculated using the month's worksheet but the same column reference each time:

    e.g. Cell B2 on the Calculator should have the following formula:
    "=COUNTIF(October!C:C,">=14")
    with the October part of the formula being whatever has been selected in the Listbox.

    When I use vba I am replacing October with ListBox1 but this either throws up an error or tries to get me to open a workbook called ListBox1.

    Unfortunately, I am unable to supply a copy of the workbook as it contains personal information about our customers.

    Thank you for any help and apologies if this is a simple one.
    Last edited by Babybio77; 12-08-2011 at 05:21 AM. Reason: Problem now solved

  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: Userforms and Using ListBox Selection in a Formula

    We can't really help without seeing the code. An example workbook would be best, can't you replace any names?
    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
    11-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Userforms and Using ListBox Selection in a Formula

    Hi Roy
    Thanks for your quick response.
    I realised the personal data wasn't essential for the coding part and have deleted that info.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Userforms and Using ListBox Selection in a Formula

    Hi Roy
    Thanks for your quick response.
    I realised the personal data wasn't essential for the coding part and have deleted that info.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Userforms and Using ListBox Selection in a Formula

    I am still looking for help with this one if anybody could shed some light?

    Thank you

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Userforms and Using ListBox Selection in a Formula

    Try this:
    Please Login or Register  to view this content.
    Btw that's a combobox, not a listbox.

  7. #7
    Registered User
    Join Date
    11-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Userforms and Using ListBox Selection in a Formula

    That's perfect . Thank you

    Knew it would be something simple, just couldn't work out how to get that reference to work

+ 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