cmt_wright
New Member
- Joined
- Nov 23, 2007
- Messages
- 8
Hi,
I have the following data in tables in a spreadsheet, and I need a vba script that looks at the whole sheet and highlights any fruit (and adjacent data) that appears more than once (note that the bottom table contains an additional column of data which should also be highlighted).
I also need it to highlight the fruit in a different colour depending on how many times it is duplicated.
For example, pear appears twice, so could be highlighted yellow, apple and orange appear three times each so they could be red.
apple 2
orange 3
pear 2
kiwi 4
mango 5
bannana 3
grape 2
peach 4
apple 2
orange 3
blueberry 2 A
coconut 2 B
orange 3 C
apple 2 D
pear 2 E
This is a small chunk of the data, but the full set will have 20 fruits and maybe 10 tables of data to compare.
At the moment I have started to write a script that has loops within loops within loops, but this isn't going to be feasible/efficient for my larger set of data.
Does anyone have some code that they can share which achieves this more efficiently?
(my vba experience is moderate)
Many thanks!!!
I have the following data in tables in a spreadsheet, and I need a vba script that looks at the whole sheet and highlights any fruit (and adjacent data) that appears more than once (note that the bottom table contains an additional column of data which should also be highlighted).
I also need it to highlight the fruit in a different colour depending on how many times it is duplicated.
For example, pear appears twice, so could be highlighted yellow, apple and orange appear three times each so they could be red.
apple 2
orange 3
pear 2
kiwi 4
mango 5
bannana 3
grape 2
peach 4
apple 2
orange 3
blueberry 2 A
coconut 2 B
orange 3 C
apple 2 D
pear 2 E
This is a small chunk of the data, but the full set will have 20 fruits and maybe 10 tables of data to compare.
At the moment I have started to write a script that has loops within loops within loops, but this isn't going to be feasible/efficient for my larger set of data.
Does anyone have some code that they can share which achieves this more efficiently?
(my vba experience is moderate)
Many thanks!!!