+ Reply to Thread
Results 1 to 3 of 3

Code to evaluate contents of one cell then write new values into new cell (Simple IF Stmt)

  1. #1
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Question Code to evaluate contents of one cell then write new values into new cell (Simple IF Stmt)

    I am looking for VBA code to evaluate the contents of every cell in Column B (if it has any cell contents - there will be something there, I just dont know how many rows there will be so I dont know where to stop evaluating).

    Basically I want code to be:
    If B2 = "PRE-FUNCTIONAL", then C2 = "Pre-Functional Commissioning" OR If B2 = "FUNCTIONAL", then C2 = "Functional Commissioning"
    If B3 = "PRE-FUNCTIONAL", then C3 = "Pre-Functional Commissioning" OR If B3 = "FUNCTIONAL", then C3 = "Functional Commissioning"
    If B4 = "PRE-FUNCTIONAL", then C4 = "Pre-Functional Commissioning" OR If B4 = "FUNCTIONAL", then C4 = "Functional Commissioning"

    And so on and so on for as many rows there are data in column B.

    I know this request is easily done with a simple =IF() within the C1 then copied down - but I dont want formulas with the cell - I want the actual words (so I know I can copy and paste as values, but thats all manually done - so thats why I want VBA).
    Last edited by clemsoncooz; 07-05-2012 at 11:28 AM.

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

    Re: Code to evaluate contents of one cell then write new values into new cell (Simple IF S

    Hello
    Try the following code:

    Please Login or Register  to view this content.
    This references Sheet1, column B.

    Hope this helps.
    DBY

  3. #3
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Re: Code to evaluate contents of one cell then write new values into new cell (Simple IF S

    Thank you!!

+ 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