J
John
Hi Everyone
I got these code from "Allexpert.com" that I will modify for my use if I can,but
it's giving me a "Syntax Error" at the "IF" statement.
Playing around I always get a error at the "IF" or the "For" statement
Can anyone help me
Sub ChangeColor()
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 (Problem area)
For Each C_2 In Data_2
If C_2 = C_1 then '(Giving Syntax Error)
Interior.ColorIndex = 12
End if
Next C_1
Next C_2
End Sub
I got these code from "Allexpert.com" that I will modify for my use if I can,but
it's giving me a "Syntax Error" at the "IF" statement.
Playing around I always get a error at the "IF" or the "For" statement
Can anyone help me
Sub ChangeColor()
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 (Problem area)
For Each C_2 In Data_2
If C_2 = C_1 then '(Giving Syntax Error)
Interior.ColorIndex = 12
End if
Next C_1
Next C_2
End Sub