+ Reply to Thread
Results 1 to 5 of 5

Allowing user to choose variable from a list for arithmetic operations

  1. #1
    Forum Contributor
    Join Date
    04-19-2016
    Location
    Michigan
    MS-Off Ver
    15.0
    Posts
    130

    Allowing user to choose variable from a list for arithmetic operations

    Good morning guys.

    Right now I have a macro to add 20% of a cell value (or a range of values) to that specific cell(s).

    It goes like this:

    Please Login or Register  to view this content.
    I can obviously create a bunch of different macros so people can choose from in order to process something like apply a tax rates or a tariff fee addition:

    suZfu96.png

    But would you please help me if I can streamline it all and perhaps use a form plus a model so that users can simply select the "label" - and then the constant alongside with the arithmetic operations will be applied to the selected value(s)?

    Thanks very much, I am still trying to familiarize myself with these basic concepts so it is a struggle at the beginning.

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Allowing user to choose variable from a list for arithmetic operations

    Hello
    Find attached an example of a User Form that makes a calculation on a specific range of cells based on a List Box selection.

    Perhaps you can amend this to your workbook.

    DBY
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Allowing user to choose variable from a list for arithmetic operations

    A quick & easy fix would be to attach your "Num" value to an input box... something like:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    04-19-2016
    Location
    Michigan
    MS-Off Ver
    15.0
    Posts
    130

    Re: Allowing user to choose variable from a list for arithmetic operations

    Quote Originally Posted by cantosh View Post
    A quick & easy fix would be to attach your "Num" value to an input box... something like:

    Please Login or Register  to view this content.
    Hi -

    I like the quick Fix - but is there anyway we can leave the choice of what type of computation (+.-,* or /) to the end user?

    Thanks

  5. #5
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Allowing user to choose variable from a list for arithmetic operations

    The easiest way to add computation type to the simple fix is by including an additional input box in which the user would type "Add", "Subtract", etc., but that might not be very user-efficient. If you want something more user friendly (radio buttons, etc.), you would need a userform. If DBY's attachment doesn't do it for you, it would be helpful if you could post a small sample workbook (use: Go Advanced --> Manage Attachments) so we can see what you're working with, rather than operating off of hypothetical data.

+ 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. Loop workbooks and list out to user via inputbox for user to choose
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2015, 03:04 PM
  2. Excel 2010 arithmetic operations on newly macro created pivot table
    By love0126 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2013, 02:08 PM
  3. Replies: 2
    Last Post: 01-16-2013, 03:10 PM
  4. Conditional Arithmetic Operations
    By leopoldc in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-16-2012, 08:29 AM
  5. Replies: 2
    Last Post: 07-24-2012, 08:38 PM
  6. Allowing user to choose what mathmatical operator macro uses
    By Paul987 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2006, 01:04 PM
  7. [SOLVED] Entering arithmetic operations
    By Joseph N. in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-05-2006, 04:55 PM

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