+ Reply to Thread
Results 1 to 3 of 3

MACRO: enter value in cell if another cell contains specific text

  1. #1
    Registered User
    Join Date
    02-07-2011
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2007
    Posts
    2

    MACRO: enter value in cell if another cell contains specific text

    Hello All,

    I still learning the ropes in VBA, and after looking in several forums I can't seem figure out how to perform the function I'm looking for.

    I need a macro that will automatically enter "Special Discount" in cell E9 if the adjascent cell D9 contains the text "DL2". The difficulty here is D9 will never contain just "DL2", "DL2" is mearly a prefix to a much longer string that will vary, e.g. "DL2000G12500689" or "DL200F56822259".

    I need this macro to work for a range of cells D9:E13.

    -linakapp

    EDIT: Added example of problem I'm trying to solve.
    Attached Files Attached Files
    Last edited by linakapp; 02-07-2011 at 12:22 PM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: MACRO: enter value in cell if another cell contains specific text

    Can I ask why you can't do that using a normal IF/SEARCH formula?

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    02-07-2011
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: MACRO: enter value in cell if another cell contains specific text

    Because the cell I need to autofill is a drop down list. I've edited my post to include a problem excel file illustarting what I'm working with a little better.

    In the form I'm creating, the user has the option to choose a discount from a drop down menu. But if they select a item, which is also from a drop down menu, and this item contains "DL2", I would like that cell in the discount column for that particular row automatically fill in with "Discount Special".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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