+ Reply to Thread
Results 1 to 3 of 3

Cell Format variable depending on another cell value

  1. #1
    Registered User
    Join Date
    08-03-2010
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2003
    Posts
    6

    Cell Format variable depending on another cell value

    Hi, Ive got a question for you guys:

    I want a macro that, based on a cell text content, defines the format of another cell.

    In other words: I have a colum (A) named that contains currency data as text, and another colum (B) with the monetary value ($6000).

    If colum A is "dolars" I want column B to have the money format for USD 6.000
    If colum A is contains any other text value (it can say "pesos", "euros", etc etc) I want column B to have the money format for $ 6.000

    How can you do this??

    thanks a lot!
    Last edited by elobelix; 08-12-2010 at 09:12 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Cell Format variable depending on another cell value

    OK, here's a function and a sub-routine for you:

    Please Login or Register  to view this content.
    The function (which can be used as a worksheet function) takes a numeric value and a string containing the currency type and applies the correct symbol to it and formats it as a currency value. You can add as many Case "xxx" statements as you want, setting the symbol for each one.

    Note, however, that it will be sensitive to say, spelling "dollars" as "dolars".

    The subroutine applies this function to all currently selected cells, using the cell immediately to the left of each one to get the currency type. See how that works for you.

  3. #3
    Registered User
    Join Date
    08-03-2010
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Cell Format variable depending on another cell value

    Thanks! This works just fine

+ 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