Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Try again - adress from a range to combobox | Excel Programming | |||
getting the adress on the last row | Excel Programming | |||
Find value and adress | Excel Programming | |||
HOWTO Replace from Row | Excel Programming | |||
HOWTO Replace from Row | Excel Programming |