+ Reply to Thread
Results 1 to 4 of 4

to macro or not to macro Cost/Sell/Margin

  1. #1
    Registered User
    Join Date
    03-26-2008
    Posts
    18

    to macro or not to macro Cost/Sell/Margin

    I have developed 3 simple formulas for calculating Cost, Sell Price, and Margin.

    I was wondering if there was a way to create some buttons if you will telling which value / formula to use.

    Here are the formulas:

    To calculate sell price = B2/(1-B3)

    To calculate cost = B6*(1-B7)

    To calculate margin = 1-(B10/B11)

    Right now I have 3 different sets of cells, depending on what value to calculate, I fill in the variables.

    I want to have just one set and then click either calc sell price, cost, or margin.

    I was thinking about using a macros but was hoping there was another way.
    Thanks in advance for any help.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Stick with what you've got. If a sub (like worksheet_change event processing) writes to a worksheet, it flushes the undo buffer, which is a heavy price to pay. And a function would need to receive two variables and return the third, which is about the same as what you have now.

  3. #3
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    I agree with shg about avoiding macros on this example. I always try to find a non macro solution if possible (but sometimes it is not possible).

    In your case I think you could use option buttons for selecting your calculation option. This does not require a macro. You then use vlookup to populate all your labels and formula cells. The lookup table is in hidden columns in this example. You could also put it in a separate hidden sheet. I have used this approach when creating multilanguage worksheets.

    When setting up a option button, you right click your button and select Properties. There is 2 properties you need to set. This is "Caption" - the text to display, and "Linked Cell" - this is a pointer to a cell in the first column in the lookup table.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-26-2008
    Posts
    18
    Thank you thank you thank you for the input and the zipped spreadsheet.

    I appreciate all your input.

    THANKS!!!!!!

+ 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