Hello undergraduate,
I modified a macro I wrote about 2 years to parse both US and Canadian mail addresses. This macro requires that the city be followed by at least one comma, the state is abbreviated according to US Postal standards, and the Zip can be 5 digits or 9 (Zip + 4). The Zip + 4 can be separated by a hyphen, a space or neither.
The macro assumes the addresses are in column "A" of the ActiveSheet. The city will be in "A", the state in "B", and the Zip in "C" after the macro runs. If the macro does not recognize the address according to its rules (see above) then it remains untouched.
Adding the Macro- Copy the macro above pressing the keys CTRL+C
- Open your workbook
- Press the keys ALT+F11 to open the Visual Basic Editor
- Press the keys ALT+I to activate the Insert menu
- Press M to insert a Standard Module
- Paste the code by pressing the keys CTRL+V
- Make any custom changes to the macro if needed at this time.
- Save the Macro by pressing the keys CTRL+S
- Press the keys ALT+Q to exit the Editor, and return to Excel.
To Run the Macro...
To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
Bookmarks