machumpion
Registered User.
- Local time
- Today, 10:13
- Joined
- May 26, 2016
- Messages
- 93
sub match()
Dim whitebook As Workbook
Set whitebook = Workbooks("whitespace (aggregated) jun 28.xlsx")
For Each store In Workbooks("copy of NCG co-op.xlsx").Worksheets(1).Range("A1:A204")
For x = 1 To 26917
If Left(store, 4) = Workbooks("whitespace (aggregated) jun 28.xlsx").Worksheets("existing stores detail").Left(Range("C" & x), 4) Then
store.Interior.ColorIndex = 5
End If
Next
Next
End Sub
--------------
I am trying to compare the first 4 characters in a range in one book to the first 4 characters in a range in another book. I bolded the part that I am having trouble with. The code does not work when I use the left function with Range inside. Can someone tell me how to do this properly?
Dim whitebook As Workbook
Set whitebook = Workbooks("whitespace (aggregated) jun 28.xlsx")
For Each store In Workbooks("copy of NCG co-op.xlsx").Worksheets(1).Range("A1:A204")
For x = 1 To 26917
If Left(store, 4) = Workbooks("whitespace (aggregated) jun 28.xlsx").Worksheets("existing stores detail").Left(Range("C" & x), 4) Then
store.Interior.ColorIndex = 5
End If
Next
Next
End Sub
--------------
I am trying to compare the first 4 characters in a range in one book to the first 4 characters in a range in another book. I bolded the part that I am having trouble with. The code does not work when I use the left function with Range inside. Can someone tell me how to do this properly?