Dim LastRow_1 as Integer
Dim LastCol_1 as Integer
Dim Data_1 as Range
Dim LastRow_2 as Integer
Dim LastCol_2 as Integer
Dim Data_2 as Range
Dim Sh_1 as Worksheet
Dim Sh_2 as Worksheet
Dim X As Long
Dim Y As Long
Dim C_1 as Range
Dim C_2 as Range
Set Sh_1 = Activeworkbook.Sheets("Sheet1")
Set Sh_2 = Activeworkbook.Sheets("Sheet2")
LastRow_1 = Sh_1.Range("A65535").End(xlup).Row
LastCol_1 = Sh_1.Range("IV1").End(xltoLeft).Column
Set Data_1 = Sh_1.range("A1").Resize(LastRow_1,LastCol_1)
LastRow_2 = Sh_2.Range("A65535").End(xlup).Row
LastCol_2 = Sh_2.Range("IV1").End(xltoLeft).Column
Set Data_2 = Sh_2.range("A1").Resize(LastRow_2,LastCol_2)
For Each C_1 in Data_1
For Each C_2 In Data_2
If C_2 = C_1 then
found a cell on sheet2 that matched cell in sheet1
now do what you need to do
End if
Next C_2
Next C_1
I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...