+ Reply to Thread
Results 1 to 8 of 8

Have a Macro run when a certain criteria has been met.

Hybrid View

jdohler Have a Macro run when a... 10-28-2013, 01:14 PM
JOHN H. DAVIS Re: Have a Macro run when a... 10-28-2013, 01:27 PM
jdohler Re: Have a Macro run when a... 10-28-2013, 02:04 PM
JOHN H. DAVIS Re: Have a Macro run when a... 10-28-2013, 02:55 PM
jdohler Re: Have a Macro run when a... 10-28-2013, 03:06 PM
jdohler Re: Have a Macro run when a... 10-28-2013, 05:11 PM
jdohler Re: Have a Macro run when a... 10-28-2013, 09:41 PM
JOHN H. DAVIS Re: Have a Macro run when a... 10-29-2013, 06:14 AM
  1. #1
    Registered User
    Join Date
    10-28-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2010
    Posts
    14

    Have a Macro run when a certain criteria has been met.

    Hi,

    This is my first post so bare with me if I am not to clear. I have a wookbook that contains 2 sheet. The first sheet is an evaluation, where the second sheet contains a list with the names, positions, and ranks of people.

    In my Sheet "Evaluation" I have a list box where you can select the name of the person you want to evaluate. When this is done, the information of the personal is displayed in the desired cells. In this case, cell B3 is the list of possible names, while B5 contains the Rank (done through Vlookup off the sheet named "list"). Example: when someone selects "John Doe" from the list of name in B3, the Rank "Cpl" appears in cell B5.

    I have multiple option boxes that are grouped together but are set to 0 (unclicked) by default. Once clicked (example: non observed) the value in cell H13 goes to a 1 and increases by one depending on performance.

    This is where I need help. I want it so that if someone selects a person that contains the rank of either Pvt or Cpl, the value in H13 goes to a 1 automatically. So I need a macro that runs automatically behind the scenes.

    So can someone help? Much appreciated.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Have a Macro run when a certain criteria has been met.

    Maybe:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("B5")) Is Nothing Then
        Select Case Target.Value
        Case Is = "Pvt", "Cpl"
            Range("H13").Value = 1
        Case Is = "Captain"
            Range("H13").Value = 2
        End Select
    End If
    End Sub
    Not sure I understood so try on a copy first.

  3. #3
    Registered User
    Join Date
    10-28-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Have a Macro run when a certain criteria has been met.

    Hi John,

    Unfortunately that didn't work. if you have an e-mail, I could send you the file. PM me.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Have a Macro run when a certain criteria has been met.

    Why not attach a file so the entire board can have a look? To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

  5. #5
    Registered User
    Join Date
    10-28-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Have a Macro run when a certain criteria has been met.

    I wish! At work everything is restricted except the option to send e-mails. I'll have to wait a few hours till tonight and do it from home.

  6. #6
    Registered User
    Join Date
    10-28-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Have a Macro run when a certain criteria has been met.

    Ok, Here's the attached excel book. To translate: Selectionner Nom is select name and Grade = Rank.

    When selecting a name from the drop list, if it returns either Pvt or Cpl, I would like for cells H13, 17, 21 and 25 to have the value 1. (Option Non Observe will be selected automatically).

    Thanks
    Last edited by jdohler; 10-29-2013 at 12:22 AM.

  7. #7
    Registered User
    Join Date
    10-28-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Have a Macro run when a certain criteria has been met.

    Any late night help?

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Have a Macro run when a certain criteria has been met.

    There no attachment? However since you marked as solved. I guess you worked it out.

+ 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. Replies: 4
    Last Post: 01-08-2013, 12:37 PM
  2. [SOLVED] create drop down box to select multiple criteria and link macro to each criteria
    By anand_erin in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-03-2012, 06:35 PM
  3. Macro colors a cell that doesn't meet the criteria of the macro
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-30-2011, 07:28 AM
  4. Help on Macro when criteria is not met
    By Darkross in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2009, 11:50 AM
  5. autofilter macro: goto the next criteria down until certain criteria is reached
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-27-2008, 04:31 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