+ Reply to Thread
Results 1 to 3 of 3

Change text in cell based on criteria within that same cell.

Hybrid View

  1. #1
    Registered User
    Join Date
    08-23-2008
    Location
    USA
    Posts
    9

    Change text in cell based on criteria within that same cell.

    Good afternoon (at least where I am),

    I was wondering if anybody can at least point in the right direction. I'm trying to change a certain part of text within a cell value depending on whether another part of text within that same cell meets a certain criteria.

    For example:

    If cells A1 through A5 looked like this:

    ds84
    ds80
    ds75
    ds14
    ds27

    I would like to have the VBA code loop through and look at the last two numbers, and if they are less than 60, for example, then it will change the "ds" into "dt".

    Thus, the result would look like:

    ds84
    ds80
    ds75
    dt14
    dt27

    Thank you for your time.

  2. #2
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Changing text

    Hi

    Attached is a small example, that uses the RIGHT function combined with VAL to check for validity and then replace the prefix value.

    The values for the original, prefix and limit have been placed on the sheet so they can be changed by the user.

    Plus a restore macro is included to return to the original values if it is necessary.

    Regards

    Jeff
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-23-2008
    Location
    USA
    Posts
    9
    Thank you very much.

+ 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