The below code scans through a list column of data in one sheet.
If it finds a match to a second sheet, it colors the match (and writes over a cell a few columns over).
The thinkg issue I'm having is with the "If c is nothing then end".
I just want it to end this function, (which is called from a larger one), but i think its ending my entire macro.
Thanks in advance for any help!
If it finds a match to a second sheet, it colors the match (and writes over a cell a few columns over).
The thinkg issue I'm having is with the "If c is nothing then end".
I just want it to end this function, (which is called from a larger one), but i think its ending my entire macro.
Thanks in advance for any help!
Code:
Sub Alterations()
Dim csr
Dim d As Range
For Each d In Sheets("TempAlterations").Range("=OFFSET(TempAlterations!A2,0,0,COUNTA(TempAlterations!a2:A65000),1)")
Set csr = d
With Sheets("WorkHours").Range("=OFFSET(WorkHours!C2,0,0,COUNTA(WorkHours!C2:C65000),1)")
Set c = .Find(csr, LookIn:=xlValues)
If c Is Nothing Then End
firstAddress = c.Address
Do
If c.Value = d.Value Then
c.Interior.ColorIndex = 36
c.Interior.Pattern = xlSolid
c.Offset(columnoffset:=6).Value = d.Offset(columnoffset:=5).Value
c.Offset(columnoffset:=-1).Value = d.Offset(columnoffset:=4).Value
c.Offset(columnoffset:=-1).Interior.ColorIndex = 36
c.Offset(columnoffset:=-1).Interior.Pattern = xlSolid
End If
Set c = .FindNext(c)
Loop While c.Address <> firstAddress
End With
Next d
End Sub