+ Reply to Thread
Results 1 to 3 of 3

Excel Macros If cell contains word then return value in next column

  1. #1
    Registered User
    Join Date
    04-21-2016
    Location
    Tennessee
    MS-Off Ver
    2013
    Posts
    2

    Excel Macros If cell contains word then return value in next column

    I am doing billing for background checks we run at an HR firm.
    If someone could create me a macros that will return a price for each item we run in the background checks.
    Say I type "Nationwide Indicator" in C5, I want D5 to return "$5". But I want this to be an option for the entire workbook. Say I want to be able to have that same option for any cell on any worksheet in the workbook. But I also need the option if I type other words to reflect other prices in any cell as well.

    This list is:

    Credit Report = $8
    TN Felony Only = $12
    Homeland Check = $8
    County Criminal = $16
    Statewide Criminal = $13
    Social Trace = $2
    Drug Screen = $45
    Nation *** Offender registry = $5
    MVR = $5
    Federal Criminal = $8
    Federal Civil = $8
    Fingerprinting= $105
    Bankruptcy = $10
    Nationwide Indicator = $5

    Truly would appreciate some help.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel Macros If cell contains word then return value in next column

    Hi,

    Maybe the workbook sheet change event?

    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 04-21-2016 at 05:17 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-21-2016
    Location
    Tennessee
    MS-Off Ver
    2013
    Posts
    2

    Re: Excel Macros If cell contains word then return value in next column

    This is actually my first time ever working with macros and I honestly have no idea what I am doing. This is what I tried to do with what you gave me. But I don't know how to make it work.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If LCase(Target) = "credit report" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 8
    ElseIf LCase(Target) = "social trace" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 2
    ElseIf LCase(Target) = "TN Felony Only" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 12
    ElseIf LCase(Target) = "Homeland Check" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 8
    ElseIf LCase(Target) = "Criminal County" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 16
    ElseIf LCase(Target) = "Statewide" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 13
    ElseIf LCase(Target) = "Drug Screen" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 45
    ElseIf LCase(Target) = "National *** Offender Registry" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 5
    ElseIf LCase(Target) = "MVR" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 5
    ElseIf LCase(Target) = "Federal Criminal" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 8
    ElseIf LCase(Target) = "Federal Civil" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 8
    ElseIf LCase(Target) = "Fingerprinting" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 105
    ElseIf LCase(Target) = "Bankruptcy" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 10
    ElseIf LCase(Target) = "Nationwide Indicator" Then
    Application.EnableEvents = False
    Target.Cells(1, 2) = 5

    ActiveWorkbook.Save
    End If

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Return value when part of a cell matches a word in a reference column
    By crazyb78 in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 07-29-2015, 05:28 AM
  2. UDF to return one of each word found in a column to a single cell on another sheet
    By Doing my best in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2014, 12:12 PM
  3. Return Value from ActiveX objects in word to Excel cell with VBA
    By Bredo2102 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2014, 07:42 AM
  4. [SOLVED] looking to find 1 of 2 words in a cell in column B and return the word found in the same
    By Rob69mfj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-27-2014, 01:17 PM
  5. [SOLVED] Look up a column and return a value 1 cell below the word yes
    By Martin Chamberlin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2013, 03:46 PM
  6. If one column cell contains "y", return corresponding column word
    By JKK123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2013, 04:32 AM
  7. Replies: 5
    Last Post: 11-18-2005, 06:10 PM

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