+ Reply to Thread
Results 1 to 4 of 4

Vba Useform: labelling depending on multiple variables

  1. #1
    Registered User
    Join Date
    04-06-2014
    Location
    Sao Paulo, Brasil
    MS-Off Ver
    Excel 2010
    Posts
    19

    Vba Useform: labelling depending on multiple variables

    Hello,

    I have the following issue:

    I have a table of data, and would like my userform to select parts on this depending on different variables.

    When I run the macro "Show_UserFormCalculatePrice" or click the button "Calculate Price", the userform is activated which has 2 comboboxes, Date and Service.

    When a certain date a service are selected I would like the the dish name to show in the labels of the userform.

    My main issue is that there will be multiple dishes that will correspond to the data, and I would like them to be vertically listed in the labels depending on their number (Column A).

    Essentially I would like to run some sort of If function:

    If the date and the service correspond to the criteria then they are shown in the labels.

    I am sorry that this is such a convoluted explanation.

    Any help would be greatly appreictaed.

    Benedict

    VBALabeling.xlsm

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

    Re: Vba Useform: labelling depending on multiple variables

    Wouldn't it be a better idea to display the dish names in a listbox?

    Each time a new date/dish is selected it would be added to the listbox.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    04-06-2014
    Location
    Sao Paulo, Brasil
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Vba Useform: labelling depending on multiple variables

    Hi Norie,

    Thanks for getting back to me.

    I would prefer to use labels, because the idea is that I will have 9 labels, and there will be 9 dishes per service: 3 entradas(Starters), 3 principais (Mains) and 3 sobremesas (desserts).

    The idea is that once I have built up the database, I will be able to select the date and service, and the 9 dishes will appear.

    Benedict

  4. #4
    Registered User
    Join Date
    04-06-2014
    Location
    Sao Paulo, Brasil
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Vba Useform: labelling depending on multiple variables

    Hi

    Just to let you know I finally worked it out.

    I created another column (hidden) which contained the formula:

    =IF(B3&C3&COUNTIFS($B$3:B3;B3;$C$3:C3;C3)=0;"-";B3&C3&COUNTIFS($B$3:B3;B3;$C$3:C3;C3))

    Then i entered the code:

    Please Login or Register  to view this content.
    After this I entered "FindPratos" into the change event for cmbDateFinal and cmbServiceFinal, and it worked.

+ 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. Insert formula depending on cells depending of variables
    By elmexicano87 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2014, 01:22 PM
  2. [SOLVED] Labelling multiple occurances of variable in larger list
    By cloudwalking in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2013, 10:52 AM
  3. Depending variables
    By waqasbinsohail in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-04-2013, 08:56 PM
  4. One cell depending on a LOT of variables
    By Economystudent89 in forum Excel General
    Replies: 6
    Last Post: 11-20-2009, 11:17 PM
  5. [SOLVED] Setting a Range depending on variables
    By mazo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2006, 12:15 PM

Tags for this Thread

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