'I need to use the Offset function to look at more than one column. Can I use this code on a range of specific columns?

I need to use the Offset function to look at more than one column. Can I use this code on a range of specific columns?

'Assign Unique Customer Numbers

Sheets("Subjects").Select            
i = 1
Range("A2") = i
Set IDRange = Range("B3:B" & LastFullRow)
       
    For Each z In IDRange
        If z = z.Offset(-1, 0) Then
            z.Offset(0, -1) = i
        ElseIf z <> z.Offset(-1, 0) Then
            i = i + 1
            z.Offset(0, -1) = i
        End If
    Next z


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source