I have two sheets: the first with data with column headers as 'Line#s' I need to change based off of a lookup table on the second sheet. Both tables have an overall category (ID) and sub-category (Type). The header names in the lookup table vary depending both categories. I need a condition statement to choose the correct value that looks at the category values and make sure they match. My first table looks something like this:
[TABLE="width: 300"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Type
[/TD]
[TD]Line13
[/TD]
[TD]Line17
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]123
[/TD]
[TD]234
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]456
[/TD]
[TD]124
[/TD]
[/TR]
</tbody>[/TABLE]
The lookup table is large with values for multiple ID's and Types like follows:
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Type
[/TD]
[TD]Line #
[/TD]
[TD]Gas
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]A
[/TD]
[TD]13
[/TD]
[TD]H2O
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]A
[/TD]
[TD]17
[/TD]
[TD]CO2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]13
[/TD]
[TD]H2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]17
[/TD]
[TD]CO2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]C
[/TD]
[TD]17
[/TD]
[TD]O2
[/TD]
[/TR]
[TR]
[TD]556
[/TD]
[TD]A
[/TD]
[TD]13
[/TD]
[TD]N20
[/TD]
[/TR]
[TR]
[TD]556
[/TD]
[TD]B
[/TD]
[TD]13
[/TD]
[TD]H2
[/TD]
[/TR]
[TR]
[TD]556
[/TD]
[TD]C
[/TD]
[TD]13
[/TD]
[TD]CO2
[/TD]
[/TR]
</tbody>[/TABLE]
Therefore the result should find the corresponding gas name for the Line # and replace it looking like this:
[TABLE="width: 300"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Type[/TD]
[TD]H2
[/TD]
[TD]CO2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]123
[/TD]
[TD]234
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]456
[/TD]
[TD]124
[/TD]
[/TR]
</tbody>[/TABLE]
The incoming data usually has a single ID with multiple types but I have acquired code to break up the data into multiple sheets each with one ID and one Type to make the column header change valid.
Help would be tremendously appreciated! I am new to VBA and do not understand the language
[TABLE="width: 300"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Type
[/TD]
[TD]Line13
[/TD]
[TD]Line17
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]123
[/TD]
[TD]234
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]456
[/TD]
[TD]124
[/TD]
[/TR]
</tbody>[/TABLE]
The lookup table is large with values for multiple ID's and Types like follows:
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Type
[/TD]
[TD]Line #
[/TD]
[TD]Gas
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]A
[/TD]
[TD]13
[/TD]
[TD]H2O
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]A
[/TD]
[TD]17
[/TD]
[TD]CO2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]13
[/TD]
[TD]H2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]17
[/TD]
[TD]CO2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]C
[/TD]
[TD]17
[/TD]
[TD]O2
[/TD]
[/TR]
[TR]
[TD]556
[/TD]
[TD]A
[/TD]
[TD]13
[/TD]
[TD]N20
[/TD]
[/TR]
[TR]
[TD]556
[/TD]
[TD]B
[/TD]
[TD]13
[/TD]
[TD]H2
[/TD]
[/TR]
[TR]
[TD]556
[/TD]
[TD]C
[/TD]
[TD]13
[/TD]
[TD]CO2
[/TD]
[/TR]
</tbody>[/TABLE]
Therefore the result should find the corresponding gas name for the Line # and replace it looking like this:
[TABLE="width: 300"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Type[/TD]
[TD]H2
[/TD]
[TD]CO2
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]123
[/TD]
[TD]234
[/TD]
[/TR]
[TR]
[TD]421
[/TD]
[TD]B
[/TD]
[TD]456
[/TD]
[TD]124
[/TD]
[/TR]
</tbody>[/TABLE]
The incoming data usually has a single ID with multiple types but I have acquired code to break up the data into multiple sheets each with one ID and one Type to make the column header change valid.
Help would be tremendously appreciated! I am new to VBA and do not understand the language