Rodney Jorgensen
Active Member
- Joined
- Nov 9, 2007
- Messages
- 411
I am getting this Compile Error:
Expected: Get or Let or Set
when I try and run this code. I had used this in a previous workbook and it worked. I had seen this compile error before when I tried it in a different workbook. Now I need to get it available in my new workbook. I have copied the module to my new workbook where I need this to work.
The code does 2 things, first, runs the RemovePunctuation Function (I believe this is where the Compile Error is comming from) and second replaces all the Abbreviations listed.
Thanks for your help.
Expected: Get or Let or Set
when I try and run this code. I had used this in a previous workbook and it worked. I had seen this compile error before when I tried it in a different workbook. Now I need to get it available in my new workbook. I have copied the module to my new workbook where I need this to work.
The code does 2 things, first, runs the RemovePunctuation Function (I believe this is where the Compile Error is comming from) and second replaces all the Abbreviations listed.
Code:
Sub Property()
Application.ScreenUpdating = False
Worksheets("Final").Select
Dim c As Range, t As String
For Each c In Range("BW4:BZ92")
t = UCase(" " & RemovePunctuation(c.Text) & " ")
t = Replace(t, " AVE ", " AVENUE ")
t = Replace(t, " BLVD ", " BOULEVARD ")
t = Replace(t, " BVD ", " BOULEVARD ")
t = Replace(t, " CYN ", " CANYON ")
t = Replace(t, " CTR ", " CENTER ")
t = Replace(t, " CIR ", " CIRCLE ")
t = Replace(t, " CT ", " COURT ")
t = Replace(t, " DR ", " DRIVE ")
t = Replace(t, " FWY ", " FREEWAY ")
t = Replace(t, " HBR ", " HARBOR ")
t = Replace(t, " HTS ", " HEIGHTS ")
t = Replace(t, " HWY ", " HIGHWAY ")
t = Replace(t, " JCT ", " JUNCTION ")
t = Replace(t, " LN ", " LANE ")
t = Replace(t, " MTN ", " MOUNTAIN ")
t = Replace(t, " PKWY ", " PARKWAY ")
t = Replace(t, " PL ", " PLACE ")
t = Replace(t, " PLZ ", " PLAZA ")
t = Replace(t, " RDG ", " RIDGE ")
t = Replace(t, " RD ", " ROAD ")
t = Replace(t, " RTE ", " ROUTE ")
t = Replace(t, " ST ", " STREET ")
t = Replace(t, " TRWY ", " THROUGHWAY ")
t = Replace(t, " TL ", " TRAIL ")
t = Replace(t, " TPKE ", " TURNPIKE ")
t = Replace(t, " VLY ", " VALLEY ")
t = Replace(t, " VLG ", " VILLAGE ")
t = Replace(t, " APT ", " APARTMENT ")
t = Replace(t, " APTS ", " APARTMENTS ")
t = Replace(t, " BLDG ", " BUILDING ")
t = Replace(t, " FLR ", " FLOOR ")
t = Replace(t, " OFC ", " OFFICE ")
t = Replace(t, " OF ", " OFFICE ")
t = Replace(t, " APT ", " APARTMENT ")
t = Replace(t, " STE ", " SUITE ")
t = Replace(t, " N ", " NORTH ")
t = Replace(t, " E ", " EAST ")
t = Replace(t, " S ", " SOUTH ")
t = Replace(t, " W ", " WEST ")
t = Replace(t, " NE ", " NORTHEAST ")
t = Replace(t, " SE ", " SOUTHEAST ")
t = Replace(t, " SW ", " SOUTHWEST ")
t = Replace(t, " NW ", " NORTHWEST ")
t = Replace(t, " MHP ", " MOBILE HOME PARK ")
t = Replace(t, " ", "")
c = t
Next
Application.ScreenUpdating = True
End Sub
Function RemovePunctuation(r As String) As String
With CreateObject("vbscript.regexp")
.Pattern = "[^A-Z0-9 ]"
.IgnoreCase = True
.Global = True
RemovePunctuation = .Replace(r, "")
End With
End Function
Thanks for your help.