Highlight row on one sheet if a number matches on another sheet
Solved/Closed
jingles9
Posts
7
Registration date
Thursday February 27, 2014
Status
Member
Last seen
September 25, 2015
-
Feb 27, 2014 at 10:00 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 4, 2014 at 11:18 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 4, 2014 at 11:18 AM
Related:
- Highlight row if cell contains text google sheets
- Sheet right to left google sheets - Guide
- Google meet download for pc - Download - Video calls
- Free fire id transfer facebook to google - Guide
- Saints row 2 cheats - Guide
- Google authenticator pc - Download - Password management
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Feb 27, 2014 at 11:07 AM
Feb 27, 2014 at 11:07 AM
Hi Jingles9,
Assuming row 1 is used for header and that the data in column C has already been entered, try this code:
The highlighted row is colored red (ColorIndex = 3). If you wish to change color, then record a macro, applying your color, stop recording, check which ColorIndex Excel has given your color.
Best regards,
Trowa
Assuming row 1 is used for header and that the data in column C has already been entered, try this code:
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
The highlighted row is colored red (ColorIndex = 3). If you wish to change color, then record a macro, applying your color, stop recording, check which ColorIndex Excel has given your color.
Best regards,
Trowa
Feb 27, 2014 at 12:08 PM
Feb 28, 2014 at 09:57 AM
Mar 3, 2014 at 10:57 AM
The code needs to go into a module. After opening VB, go to top menu and select Insert > Module. Paste the code in the big white field.
Back at Excel hit Alt+F8 to display available macro's and double-click RunMe.
From what I understood you want to loop through Column C of the Directory sheet and compare the data with Column C of the MC sheet. If they match, change the row color on the Directory sheet.
Example:
Directory sheet, C2 = 1 and MC sheet, C2 = 2 then no match > do nothing.
Directory sheet, C3 = 3 and MC sheet, C3 = 3 then match found > Directory sheet, row 3 will be colored.
Best regards,
Trowa
Mar 4, 2014 at 07:49 AM
Mar 4, 2014 at 09:05 AM
Directory sheet, C3=3 and MC sheet, C8=3 then match found >Directory sheet, row 3 will be coloured
Directory sheer, C4=8 and MC sheet column C does not have 8 in it, then no match >do nothing