Split addresses into address parts with VBA in Excel

Barb Henderson
Barb Henderson
3.8 هزار بار بازدید - 2 سال پیش - Split addresses into address parts
Split addresses into address parts with VBA in Excel. Split address into street address, city , province and postal code. Free templates and templates with code are available for purchase for $50 USD www.easyexcelanswers.com/templates.html For more help visit my website www.easyexcelanswers.com or email me at [email protected]. Contact me regarding customizing this template for your needs. Click for online Excel Consulting www.calendly.com/easyexcelanswers I am able to provide online help on your computer at a reasonable rate. www.amazon.com/shop/barbhenderson I use a Blue condenser Microphone to record my videos, here is the link amzn.to/37gyyGa Check out Crowdcast for creating your webinars app.linkmink.com/a/crowdcast/83 I use Tube Buddy to help promote my videos Check them out www.Tubebuddy.com/easyexcelanswers Follow me on Facebook www.facebook.com/easyexcel.answers TWEET THIS VIDEO    • Split addresses into address parts wi...   Follow me on twitter easyexcelanswers IG @barbhendersonconsulting You can help and generate a translation to you own language youtube.com/timedtext_cs_panel?c=UCFH2kZykqt-VX5W9… *this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I've used or have experience with. Templates with code are available for $50 USD code Sub splitaddress() Dim address As String Dim street As String Dim city As String Dim prov As String Dim postc As String Dim intPos, secpos As Integer Dim thrd As Long Dim r As Integer Worksheets("sheet1").Select r = 2 Do While r (is less than) 242 address = Sheet1.Cells(r, 2) intPos = InStr(address, ",") ' find the comma street = Left(address, intPos) 'address is what ever comes before the first comma secpos = InStr(intPos + 1, address, ",") 'find the second comma diff = secpos - intPos 'calculate the number of spaces between the first and the second comma city = Mid(address, intPos + 1, diff) 'allow for comma and a space postc = Right(address, 7) ' take seven charaters from the right side of the cell thrd = InStr(secpos + 1, address, ",") 'looking for the third comma prov = Mid(address, secpos + 1, 3) 'find the provices Sheet1.Cells(r, 3) = street Sheet1.Cells(r, 4) = city Sheet1.Cells(r, 5) = prov Sheet1.Cells(r, 6) = postc r = r + 1 Loop End Sub
2 سال پیش در تاریخ 1401/10/25 منتشر شده است.
3,813 بـار بازدید شده
... بیشتر