Code For Find & Highlight

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,786
Office Version
  1. 365
Platform
  1. Windows
I hope I can explain this ok! I need the code to firstly look at column C on Sheet 1. Where there are rows with the same data in C I need the code to look at column AB and see that both the numbers/text in column A & B on sheet 2 are in the rows if not highlight the rows.

i.e

The word example is in 4 rows it then looks at column AB and sees the word ABC it looks for ABC on sheet 2 and because DEF is next to ABC on sheet 2 but not in AB on sheet 1 it highlights the row.

If you look at example 3 both STU and VWX are in the range so it leaves the rows white. Thanks

Excel Workbook
ABCDE
1ABCD-AAAB
2Various dataVarious dataExampleVarious dataABC
3Various dataVarious dataExampleVarious dataABC
4Various dataVarious dataExampleVarious dataABC
5Various dataVarious dataExampleVarious dataABC
6Various dataVarious dataExample1Various dataJKL
7Various dataVarious dataExample1Various dataJKL
8Various dataVarious dataExample1Various dataJKL
9Various dataVarious dataExample1Various dataJKL
10Various dataVarious dataExample1Various dataJKL
11Various dataVarious dataExample2Various dataPQR
12Various dataVarious dataExample2Various dataPQR
13Various dataVarious dataExample2Various dataPQR
14Various dataVarious dataExample2Various dataPQR
15Various dataVarious dataExample2Various dataPQR
16Various dataVarious dataExample3Various dataSTU
17Various dataVarious dataExample3Various dataVWX
18Various dataVarious dataExample3Various dataSTU
19Various dataVarious dataExample3Various dataSTU
Sheet1


Excel Workbook
AB
1Part 1Part 2
2ABCDEF
3GHIJKL
4MNOPQR
5STUVWX
Sheet2
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I hope I can explain this ok! I need the code to firstly look at column C on Sheet 1. Where there are rows with the same data in C I need the code to look at column AB and see that both the numbers/text in column A & B on sheet 2 are in the rows if not highlight the rows.

i.e

The word example is in 4 rows it then looks at column AB and sees the word ABC it looks for ABC on sheet 2 and because DEF is next to ABC on sheet 2 but not in AB on sheet 1 it highlights the row.

If you look at example 3 both STU and VWX are in the range so it leaves the rows white. Thanks

Excel Workbook
ABCDE
1ABCD-AAAB
2Various dataVarious dataExampleVarious dataABC
3Various dataVarious dataExampleVarious dataABC
4Various dataVarious dataExampleVarious dataABC
5Various dataVarious dataExampleVarious dataABC
6Various dataVarious dataExample1Various dataJKL
7Various dataVarious dataExample1Various dataJKL
8Various dataVarious dataExample1Various dataJKL
9Various dataVarious dataExample1Various dataJKL
10Various dataVarious dataExample1Various dataJKL
11Various dataVarious dataExample2Various dataPQR
12Various dataVarious dataExample2Various dataPQR
13Various dataVarious dataExample2Various dataPQR
14Various dataVarious dataExample2Various dataPQR
15Various dataVarious dataExample2Various dataPQR
16Various dataVarious dataExample3Various dataSTU
17Various dataVarious dataExample3Various dataVWX
18Various dataVarious dataExample3Various dataSTU
19Various dataVarious dataExample3Various dataSTU
Sheet1


Excel Workbook
AB
1Part 1Part 2
2ABCDEF
3GHIJKL
4MNOPQR
5STUVWX
Sheet2


From your example shouldn't Sheet 1 Line 17 be highlighted?
 
Upvote 0
From your example shouldn't Sheet 1 Line 17 be highlighted?

No, because in that range of 'example3' it has looked at STU (or VWX) on sheet 2 and as VWX (or STU) is next to it and it is in the range of example3 it doesnt highlight because both are in the range.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top