I'm trying to write a macro in VBA to split a bunch of addresses all in the same format into separate columns. So a street address column, suburb, postcode and state code column. The addresses all follow this format:
123 Fake Street, Suburbia QLD 4123
I wish I could approach this using SQL but I'm trying to keep this function inside an excel workbook where addresses would be central.
My planned approach is to write a for loop which counts the length of column D (where the addresses are stored)...so
For LngRow = 2 To Wksht.Range("D" & Wksht.Rows.Count).End(xlUp).Row
//concate/parse here//
Next
and then it would follow a standard procedure of working backwards where it would separate and write the postcode (4 digits), then the state code (an array of state codes), then the suburb (the string between the state code and the delimiting comma after the street address), and finally the street address which is whatever string is remaining after the rest has been removed and rewritten.
I figure working backwards is best since the street address changes whereas the final 3 bits of info are standard.
Is it possible to write such a macro in VBA? Especially given how SQLish it seems.