+ Reply to Thread
Results 1 to 12 of 12

VBA to search a group of cells and input a message if a value is missing from the group

  1. #1
    Registered User
    Join Date
    03-11-2014
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    10

    VBA to search a group of cells and input a message if a value is missing from the group

    Hello;

    I am very new at VBA. I am trying to write VBA code that groups cells between blank rows and inserts a message if a string of text (a name) is missing from the entire group. I want the code to search cells in column A and group the cells between blank cells. Use the name I input in an input box as the search criteria and insert a message in the Column C next to the last blank cell in the group and then move on to the next group and highlight the cell in red with bold text. I am including a spreadsheet with an example of what the sheet should look like before and after the code is run.

    Any help would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Try this:-
    NB:- At the moment it does not search for "Named Supervisor"
    Nb:- Code run on sheet "Before"
    Please Login or Register  to view this content.
    Regards Mick
    Last edited by MickG; 03-17-2014 at 10:14 AM.

  3. #3
    Registered User
    Join Date
    03-11-2014
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    One additional question. I have some cells that have additional information after the name (e.g. initials, phone, etc.) and the code does not recognize these cells as having the value even if the name is there. Is there a way I can get the code to recognize the name with additional text in the cell?

    Other than that to code works great.

    Thank you for your help
    Last edited by ntaylor652; 03-17-2014 at 01:18 PM.

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Can you show some examples, of some Names with extra data, as I would need to split each cell value to Isolate the actual name.

  5. #5
    Registered User
    Join Date
    03-11-2014
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Here is an example of what the data might look like. See the information for Sarah Brown as an example. How would I get the code to recognize that Sarah Brown is in the group if there is additional information in addition to her name in the cell? Any help you could give would be appreciated.

    Week 1 - Shift A
    Supervisor: John Taylor
    Zack Johnson
    Allen Green
    Ryan Harris
    Sylvia Anderson

    Week 2 - Shift B
    Supervisor: Alex Sizemore
    Sarah Brown
    Zack Johnson
    Allen Green
    Sylvia Anderson

    Week 3 - Shift C
    Supervisor: Janice Cooper
    Sarah Brown ph.555-613-1212
    Zack Johnson
    Allen J. Green
    Ryan Harris
    Sylvia Anderson

    Week 4 - Shift A
    Supervisor: John Taylor
    (Supervisor Fill In) Sarah Brown
    Allen Green
    Ryan Harris
    Sylvia Anderson

    Week 5 - Shift B
    Supervisor: Alex Sizemore
    Sarah Brown (Late 10 minutes)
    Zack Johnson
    Allen Green
    Sylvia Anderson

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  7. #7
    Registered User
    Join Date
    03-11-2014
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Mick;

    Thank you for all your help so far. Unfortunately the code did not work. It stopped at
    Please Login or Register  to view this content.
    . I cannot see in the code where Nam or n are set and used. Not sure how to fix. Any other suggestions?

  8. #8
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    If one of the groups only consists of one line, then try this:-
    Otherwise please sent example file.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-11-2014
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Mick;

    I figured out the problem. Thank you so much for your help!
    Regards;

    Nancy

  10. #10
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    You're welcome
    What was the problem ???

  11. #11
    Registered User
    Join Date
    03-11-2014
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Typo in the code - wrong column reference. It works perfectly now. Thank you again for your help.

  12. #12
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to search a group of cells and input a message if a value is missing from the grou

    Thanks for the feedback, glad its working.
    Regrds Mick

+ 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: 1
    Last Post: 02-10-2014, 10:26 PM
  2. Searching through a group of cells to find missing people.
    By babak_jani in forum Excel General
    Replies: 1
    Last Post: 11-14-2013, 01:52 AM
  3. Replies: 0
    Last Post: 06-17-2013, 07:25 PM
  4. Replies: 0
    Last Post: 02-04-2013, 03:25 PM
  5. Replies: 1
    Last Post: 02-17-2011, 04:05 AM

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