Hi everyone, I could not find a solution for this.
On Sheet 1 I have a table such as this:
[TABLE="width: 160"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Vehicle
Car[/TD]
[TD]Colour Code
Red[/TD]
[/TR]
[TR]
[TD]Bicycle[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]Tricycle[/TD]
[TD]Yellow[/TD]
[/TR]
[TR]
[TD]Motorcycle[/TD]
[TD]Yellow[/TD]
[/TR]
[TR]
[TD]Train[/TD]
[TD]White[/TD]
[/TR]
[TR]
[TD]Plane[/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Boat[/TD]
[TD]Aqua[/TD]
[/TR]
</tbody>[/TABLE]
On Sheet 2 I have another table such as this:
[TABLE="width: 288"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]Vehicle[/TD]
[TD]Cost[/TD]
[TD]Rental[/TD]
[TD]Tickets[/TD]
[/TR]
[TR]
[TD]Motorcycle[/TD]
[TD="align: right"]25000[/TD]
[TD]Yes[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Plane[/TD]
[TD="align: right"]2000000[/TD]
[TD]No[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Bicycle[/TD]
[TD="align: right"]200[/TD]
[TD]Yes[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Car[/TD]
[TD="align: right"]50000[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[/TR]
</tbody>[/TABLE]
I am looking for a VBA code which will look up the colour code in sheet 1, and apply the colour listed to the cell fill colour under each cell in the Vehicle column of sheet 2.
I have used VBA for conditional formatting, but with very few criteria, in my real example, there may be up to two dozen different "vehicles" in the colour code sheet.
Thanks for any help getting this in the right direction.
On Sheet 1 I have a table such as this:
[TABLE="width: 160"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Vehicle
Car[/TD]
[TD]Colour Code
Red[/TD]
[/TR]
[TR]
[TD]Bicycle[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]Tricycle[/TD]
[TD]Yellow[/TD]
[/TR]
[TR]
[TD]Motorcycle[/TD]
[TD]Yellow[/TD]
[/TR]
[TR]
[TD]Train[/TD]
[TD]White[/TD]
[/TR]
[TR]
[TD]Plane[/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Boat[/TD]
[TD]Aqua[/TD]
[/TR]
</tbody>[/TABLE]
On Sheet 2 I have another table such as this:
[TABLE="width: 288"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]Vehicle[/TD]
[TD]Cost[/TD]
[TD]Rental[/TD]
[TD]Tickets[/TD]
[/TR]
[TR]
[TD]Motorcycle[/TD]
[TD="align: right"]25000[/TD]
[TD]Yes[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Plane[/TD]
[TD="align: right"]2000000[/TD]
[TD]No[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Bicycle[/TD]
[TD="align: right"]200[/TD]
[TD]Yes[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Car[/TD]
[TD="align: right"]50000[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[/TR]
</tbody>[/TABLE]
I am looking for a VBA code which will look up the colour code in sheet 1, and apply the colour listed to the cell fill colour under each cell in the Vehicle column of sheet 2.
I have used VBA for conditional formatting, but with very few criteria, in my real example, there may be up to two dozen different "vehicles" in the colour code sheet.
Thanks for any help getting this in the right direction.