+ Reply to Thread
Results 1 to 4 of 4

highlight row on one sheet if name in column matches on another sheet within same workbook

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    highlight row on one sheet if name in column matches on another sheet within same workbook

    Hello, I have a spreadsheet with multiple tabs. I am trying to figure out how to get a row to highlight on the tab called "Directory" if the Surname and First name (column A and B) matches the Surname and First name (Column A and B) on another tab labelled MC. Any assistance would be greatly appreciated
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: highlight row on one sheet if name in column matches on another sheet within same work

    Hello everyone...we have determined that instead of having to match both column A & B we can just use column C as it is a unique number for each person. That said, does anyone know if it is possible to check column C on both sheets (Directory and MC) and highlight the row on the Directory tab if it is on both sheets?

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: highlight row on one sheet if name in column matches on another sheet within same work

    Hello, I have had help obtaining some coding to highlight the row red if I run a macro, but it doesn't seem to be working. If I paste the coding on the "Directory" sheet and then run the macro "RunMe", nothing happens. If I paste the coding on the MC sheet instead, every row highlights regardless of whether or not it is a match. Here is the coding I am using:
    Sub RunMe()
    Dim lRow As Integer

    Sheets("Directory").Activate
    lRow = Range("C" & Rows.Count).End(xlUp).Row

    For Each cell In Range("C2:C" & lRow)
    If cell.Value = Sheets("MC").Cells(cell.Row, "C") Then
    Rows(cell.Row).Interior.ColorIndex = 3
    End If
    Next cell

    End Sub

    Can anyone see what I am doing wrong?

  4. #4
    Registered User
    Join Date
    05-24-2013
    Location
    London, ON
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: highlight row on one sheet if name in column matches on another sheet within same work

    the correct coding is:
    Sub RunMe()
    Dim lRow1, lRow2, x As Integer

    lRow2 = Sheets("MC").Range("C" & Rows.Count).End(xlUp).Row
    Sheets("Directory").Activate
    lRow1 = Range("C" & Rows.Count).End(xlUp).Row
    x = 1

    For Each cell In Range("C2:C" & lRow1)
    Do
    x = x + 1
    If cell.Value = Sheets("MC").Cells(x, "C") Then
    Rows(cell.Row).Interior.ColorIndex = 3
    End If
    Loop Until x = lRow2
    x = 1
    Next cell

    End Sub

+ 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] copy and paste values to another sheet if value in one column matches condition
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-05-2013, 11:36 AM
  2. [SOLVED] Formula for multiple matches to sum result from another column into another sheet
    By justmeok in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-13-2013, 06:30 PM
  3. Replies: 11
    Last Post: 10-11-2013, 08:02 AM
  4. Compare Sheet 1 and Sheet 2, and find matches and non-matches
    By danNAD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2010, 03:59 AM
  5. Replies: 1
    Last Post: 10-30-2009, 10:58 AM

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