The code below was design for used columns from Q - V. But I had to add 3 additional columns (N-P) So now I have N - V that is being used. How can I edit this code to include N-P thanks
Code:
Public Sub Find_Counties()
Dim r_Search As Range
Dim r_Items As Range
Dim r_item As Range
On Error Resume Next
Application.ScreenUpdating = False
Set r_Search = Range("T10").CurrentRegion
Set r_Items = r_Search.Cells(2, 1).Resize(Application.CountA(r_Search.Columns(1)) - 1)
If r_Items.Rows.Count < 1 Then Exit Sub 'nothing to find column Q or R
For Each r_item In r_Items.Rows
r_Search.AutoFilter 4, r_item.Offset(0, 1) 'find state
r_Search.AutoFilter 5, r_item 'find city
r_item.Offset(, 2) = r_Search.Offset(1, 5).Resize(r_Search.Rows.Count - 1, 1).SpecialCells(xlCellTypeVisible)
Next
On Error GoTo 0
r_Search.AutoFilter
If r_Items.Rows.Count = 1 Then
r_Items.Offset(, 2).Value = "[Other]"
Else
r_Items.Offset(, 2).SpecialCells(xlCellTypeBlanks).Value = "[Other]"
End If
Application.ScreenUpdating = True
End Sub