AC
AD
AE
AF
AG
DWG. NO
SYM.
FS991EX
MB4250
I am a newbie in VBA
The thing is I need to compare two columns of two sheets.
My biggest problem is that sheet2 is always changing (new sheet2 will be inserted every now and then) so the column position is also varying.
I think of finding first the column header (FIX name). But I am having a hard time on how to put it in code.
The above table is an example of sheet2 data. (Note:There are many columns in the sheet.)
I use below code but i do not know if this is correct. (It is not working)
I wanted to set the found column of sheet2 as range
Sheet1is fix so I dont have problem with that
During comparison, I use For-Each so I also dont have problem with that.
My problem is Just the sheet2 range.
Can somebody help me please.
Thank you so much.
AD
AE
AF
AG
DWG. NO
SYM.
FS991EX
MB4250
I am a newbie in VBA
The thing is I need to compare two columns of two sheets.
My biggest problem is that sheet2 is always changing (new sheet2 will be inserted every now and then) so the column position is also varying.
I think of finding first the column header (FIX name). But I am having a hard time on how to put it in code.
The above table is an example of sheet2 data. (Note:There are many columns in the sheet.)
I use below code but i do not know if this is correct. (It is not working)
I wanted to set the found column of sheet2 as range
Code:
With Worksheets("sheet2")
With .Range("A2", .Cells(1, .Columns.Count).End(xlToLeft))
Set DWG_COL = .Find(what:="DWG. NO", LookIn:=xlValues, lookat:=xlWhole)
If Not DWG_COL Is Nothing Then 'if column was found set as range
Set dwg_y = Range(DWG_COL, DWG_COL.End(xlUp)) 'set sheet2 range to be compared
End If
End With
With .Range("A2", .Cells(1, .Columns.Count).End(xlToLeft))
Set SYM_COL = .Find(what:="SYM.", LookIn:=xlValues, lookat:=xlWhole)
If Not SYM_COL Is Nothing Then 'if column was found set as range
Set sym_y = Range(SYM_COL, SYM_COL.End(xlUp)) 'set sheet range to be compared
End If
End With
End With
During comparison, I use For-Each so I also dont have problem with that.
My problem is Just the sheet2 range.
Can somebody help me please.
Thank you so much.