mountainscaler
New Member
- Joined
- Jan 22, 2018
- Messages
- 4
Hello All,
I am new to the forum and have been using VBA in a limited fashion for about half a year. However, it is my goal to get a lot better at it so here I am.
My first question involves comparing values between two different workbooks using a macro. Specifically I would like to:
Example of data format in Workbook 1:
[TABLE="width: 1149"]
<tbody>[TR]
[TD="class: xl65, width: 114, bgcolor: transparent"]
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[TD]K
[/TD]
[TD]L
[/TD]
[/TR]
[TR]
[TD]Recip.
[/TD]
[TD]Area
[/TD]
[TD]analyte
[/TD]
[TD]mthd
[/TD]
[TD]grdnt
[/TD]
[TD]Well
[/TD]
[TD]date
[/TD]
[TD]smpl
[/TD]
[TD]fltrd
[/TD]
[TD]owner
[/TD]
[TD]prps
[/TD]
[TD]value
[/TD]
[/TR]
[TR]
[TD]Lab A
[/TD]
[TD]PO-1
[/TD]
[TD]alkalinity
[/TD]
[TD]310.1
[/TD]
[TD]ND
[/TD]
[TD]E24
[/TD]
[TD]12/11/17
[/TD]
[TD]B78U
[/TD]
[TD]Y
[/TD]
[TD]WHH
[/TD]
[TD]R
[/TD]
[TD]103
[/TD]
[/TR]
[TR]
[TD]Lab A
[/TD]
[TD]PO-1
[/TD]
[TD]iron
[/TD]
[TD]6010
[/TD]
[TD]ND
[/TD]
[TD]E25
[/TD]
[TD]12/11/17
[/TD]
[TD]B89P
[/TD]
[TD]N
[/TD]
[TD]WHH
[/TD]
[TD]R
[/TD]
[TD]0.03
[/TD]
[/TR]
[TR]
[TD]Lab A
[/TD]
[TD]PO-1
[/TD]
[TD]calcium
[/TD]
[TD]6010
[/TD]
[TD]ND
[/TD]
[TD]E26
[/TD]
[TD]12/15/17
[/TD]
[TD]C45T
[/TD]
[TD]Y
[/TD]
[TD]WHH
[/TD]
[TD]R
[/TD]
[TD]60.3
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Example of data format in Workbook 2:
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[/TR]
[TR]
[TD]Analyte
[/TD]
[TD]Filtered
[/TD]
[TD]units
[/TD]
[TD]Geo_mean
[/TD]
[TD]Ges_STDV
[/TD]
[TD]samp_nm
[/TD]
[TD]Min
[/TD]
[TD]Max
[/TD]
[TD]90_CL
[/TD]
[TD]95_CL
[/TD]
[/TR]
[TR]
[TD]alkalinity
[/TD]
[TD]N
[/TD]
[TD]mg/L
[/TD]
[TD]116.85
[/TD]
[TD]1183
[/TD]
[TD]30
[/TD]
[TD]80.0
[/TD]
[TD]170.0
[/TD]
[TD]147.1
[/TD]
[TD]156.4
[/TD]
[/TR]
[TR]
[TD]iron
[/TD]
[TD]Y
[/TD]
[TD]mg/L
[/TD]
[TD]0.055
[/TD]
[TD]6.17
[/TD]
[TD]22
[/TD]
[TD]0.006
[/TD]
[TD]7.2
[/TD]
[TD]0.57
[/TD]
[TD]1.10
[/TD]
[/TR]
[TR]
[TD]calcium
[/TD]
[TD]N
[/TD]
[TD]mg/L
[/TD]
[TD]36.5
[/TD]
[TD]1.33
[/TD]
[TD]25
[/TD]
[TD]19.2
[/TD]
[TD]79.7
[/TD]
[TD]52.6
[/TD]
[TD]58.4
[/TD]
[/TR]
</tbody>[/TABLE]
Any and all help would be greatly appreciated!
I am new to the forum and have been using VBA in a limited fashion for about half a year. However, it is my goal to get a lot better at it so here I am.
My first question involves comparing values between two different workbooks using a macro. Specifically I would like to:
- Look in column C of Workbook-1 and associate column C cell values with cell values in column L. Column C values will be the key values to be searched in Workbook-2.
- Then, look in Workbook-2, column A for the Workbook-1 keys and compare the values in Workbook-2 column J those in column L of Workbook-1.
- If values in Workbook-1, column L exceed those in Workbook-2, column J for rows with matching keys, then highlight the exceeding cells in Workbook-1, column L in red.
Example of data format in Workbook 1:
[TABLE="width: 1149"]
<tbody>[TR]
[TD="class: xl65, width: 114, bgcolor: transparent"]
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[TD]K
[/TD]
[TD]L
[/TD]
[/TR]
[TR]
[TD]Recip.
[/TD]
[TD]Area
[/TD]
[TD]analyte
[/TD]
[TD]mthd
[/TD]
[TD]grdnt
[/TD]
[TD]Well
[/TD]
[TD]date
[/TD]
[TD]smpl
[/TD]
[TD]fltrd
[/TD]
[TD]owner
[/TD]
[TD]prps
[/TD]
[TD]value
[/TD]
[/TR]
[TR]
[TD]Lab A
[/TD]
[TD]PO-1
[/TD]
[TD]alkalinity
[/TD]
[TD]310.1
[/TD]
[TD]ND
[/TD]
[TD]E24
[/TD]
[TD]12/11/17
[/TD]
[TD]B78U
[/TD]
[TD]Y
[/TD]
[TD]WHH
[/TD]
[TD]R
[/TD]
[TD]103
[/TD]
[/TR]
[TR]
[TD]Lab A
[/TD]
[TD]PO-1
[/TD]
[TD]iron
[/TD]
[TD]6010
[/TD]
[TD]ND
[/TD]
[TD]E25
[/TD]
[TD]12/11/17
[/TD]
[TD]B89P
[/TD]
[TD]N
[/TD]
[TD]WHH
[/TD]
[TD]R
[/TD]
[TD]0.03
[/TD]
[/TR]
[TR]
[TD]Lab A
[/TD]
[TD]PO-1
[/TD]
[TD]calcium
[/TD]
[TD]6010
[/TD]
[TD]ND
[/TD]
[TD]E26
[/TD]
[TD]12/15/17
[/TD]
[TD]C45T
[/TD]
[TD]Y
[/TD]
[TD]WHH
[/TD]
[TD]R
[/TD]
[TD]60.3
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Example of data format in Workbook 2:
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[/TR]
[TR]
[TD]Analyte
[/TD]
[TD]Filtered
[/TD]
[TD]units
[/TD]
[TD]Geo_mean
[/TD]
[TD]Ges_STDV
[/TD]
[TD]samp_nm
[/TD]
[TD]Min
[/TD]
[TD]Max
[/TD]
[TD]90_CL
[/TD]
[TD]95_CL
[/TD]
[/TR]
[TR]
[TD]alkalinity
[/TD]
[TD]N
[/TD]
[TD]mg/L
[/TD]
[TD]116.85
[/TD]
[TD]1183
[/TD]
[TD]30
[/TD]
[TD]80.0
[/TD]
[TD]170.0
[/TD]
[TD]147.1
[/TD]
[TD]156.4
[/TD]
[/TR]
[TR]
[TD]iron
[/TD]
[TD]Y
[/TD]
[TD]mg/L
[/TD]
[TD]0.055
[/TD]
[TD]6.17
[/TD]
[TD]22
[/TD]
[TD]0.006
[/TD]
[TD]7.2
[/TD]
[TD]0.57
[/TD]
[TD]1.10
[/TD]
[/TR]
[TR]
[TD]calcium
[/TD]
[TD]N
[/TD]
[TD]mg/L
[/TD]
[TD]36.5
[/TD]
[TD]1.33
[/TD]
[TD]25
[/TD]
[TD]19.2
[/TD]
[TD]79.7
[/TD]
[TD]52.6
[/TD]
[TD]58.4
[/TD]
[/TR]
</tbody>[/TABLE]
Any and all help would be greatly appreciated!