![]() |
howto replace the order of adress ?
hi
i have rows that contain two shapes of adresses that i need to fix: example1 : Rose street 25 4 Blabla ---- Rose street 4/25 Blabla example2: Rose street 25/4 Blabla ---- Rose street 4/25 Blabla thanks |
howto replace the order of adress ?
On Thu, 13 Dec 2007 07:05:00 -0800, ???? wrote:
hi i have rows that contain two shapes of adresses that i need to fix: example1 : Rose street 25 4 Blabla ---- Rose street 4/25 Blabla example2: Rose street 25/4 Blabla ---- Rose street 4/25 Blabla thanks Given your specific format, the following Macro will do what you describe, putting the altered results into the adjacent column. You can modify this in many ways, depending on your specific requirements. The critical part of your format is that the first string of digits separated by either a <space or a "/" will be reversed in place and separated by a "/" ========================================== Option Explicit Sub FixAdr() Dim re As Object Dim c As Range Const sPat As String = "(\d+)[/\s]+(\d+)" Const sRes As String = "$2/$1" Set re = CreateObject("vbscript.regexp") re.Pattern = sPat For Each c In Selection c.Offset(0, 1).Value = _ re.Replace(c.Text, sRes) Next c End Sub ===================================== --ron |
All times are GMT +1. The time now is 12:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com