I have a macro (below) used to clean up a file of addresses. One of my clean steps is to flag any addresses which contain number ranges (i.e. a dash "-"). It was working fine but now that I have a larger file with 10k+ addresses I think I need to adjust to make it less restrictive. Here are a few examples in the file that are probably legit because of apartment or lot numbers, but we’re excluding them. I know there’s only so much that can be done programmatically. But is there any way to allow them if there’s an alpha character before or after the dash? That would allow all of these back in:
112 E Amherst Street A - 17
14405 Columbiana-Canfield Road
1561 Edge Hill Rd. Apt. B-1
16300 pine ridge road Lot T-12
17014 Arrows-Peak Ln
2320 N. 196th Place Apt. Q-105
285 Quinnipiac Ave APT C-1
300 East 75th Street 7-H
3300 So. Sepulveda Blvd. Apt. K-17
235 W. 76th Street Apt # 14-B
2461 E.High St Apt.I-101
Below are examples of addresses I am concerned about and need to flag:
100-11 67th road 111
103-14 Metropolitan Ave. Apt. 1
110-11 72 ave apt 2a
146-26 243 street
147-26 70th Avenue
20-62 28th Street
------------------------------------
Sub H1_Copy_Dash()
Sheets("Dash Addresses").Visible = True
Dim strArray As Variant
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim NoRows As Long
Dim DestNoRows As Long
Dim i As Long
Dim J As Integer
Dim rngCells As Range
Dim rngFind As Range
Dim Found As Boolean
strArray = Array("-")
Set wsSource = ActiveSheet
NoRows = wsSource.Range("A100000").End(xlUp).Row
DestNoRows = 1
Set wsDest = ActiveWorkbook.Sheets("Dash Addresses")
For i = 1 To NoRows
Set rngCells = wsSource.Range("H" & i & ":H" & i)
Found = False
For J = 0 To UBound(strArray)
Found = Found Or Not (rngCells.Find(strArray(J)) Is Nothing)
Next J
If Found Then
rngCells.EntireRow.Copy wsDest.Range("A" & DestNoRows)
DestNoRows = DestNoRows + 1
End If
Next i
Sheets("Address Details").Select
End Sub
Thank You in advance for any suggestions here.
112 E Amherst Street A - 17
14405 Columbiana-Canfield Road
1561 Edge Hill Rd. Apt. B-1
16300 pine ridge road Lot T-12
17014 Arrows-Peak Ln
2320 N. 196th Place Apt. Q-105
285 Quinnipiac Ave APT C-1
300 East 75th Street 7-H
3300 So. Sepulveda Blvd. Apt. K-17
235 W. 76th Street Apt # 14-B
2461 E.High St Apt.I-101
Below are examples of addresses I am concerned about and need to flag:
100-11 67th road 111
103-14 Metropolitan Ave. Apt. 1
110-11 72 ave apt 2a
146-26 243 street
147-26 70th Avenue
20-62 28th Street
------------------------------------
Sub H1_Copy_Dash()
Sheets("Dash Addresses").Visible = True
Dim strArray As Variant
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim NoRows As Long
Dim DestNoRows As Long
Dim i As Long
Dim J As Integer
Dim rngCells As Range
Dim rngFind As Range
Dim Found As Boolean
strArray = Array("-")
Set wsSource = ActiveSheet
NoRows = wsSource.Range("A100000").End(xlUp).Row
DestNoRows = 1
Set wsDest = ActiveWorkbook.Sheets("Dash Addresses")
For i = 1 To NoRows
Set rngCells = wsSource.Range("H" & i & ":H" & i)
Found = False
For J = 0 To UBound(strArray)
Found = Found Or Not (rngCells.Find(strArray(J)) Is Nothing)
Next J
If Found Then
rngCells.EntireRow.Copy wsDest.Range("A" & DestNoRows)
DestNoRows = DestNoRows + 1
End If
Next i
Sheets("Address Details").Select
End Sub
Thank You in advance for any suggestions here.