PDA

View Full Version : Transfert fron cell with condition



wilder
02-26-2009, 02:17 PM
Hello,

I need your help for my macro,


For n = 3 To Range("e65536").End(xlUp).Row
x = Split(Range("e" & n), " ")
Range("f" & n) = x(UBound(x) - 1)

For m = 0 To UBound(x) - 4
z = z & " " & x(m)
Next m

Next n

What I want to do his that in all cells on E column, you have a postal code.
It transfer the 3 first digits from the postal code in the cells in the right.

Now my problem his that if the 3 first digits his more that 2 times in the E column, it will look at the 3 next digits an if it his not the same, it will transfer all the zip code in the cell on the right, but if the 3 last digits are the same, it will transfer only the 3 first digits.

How can I do that please?

Thanks for you help.

wilder

MaximS
02-26-2009, 02:48 PM
try that, see attachment for details. I have changed that a bit.

wilder
02-26-2009, 06:49 PM
Thanks, that what a was looking for.

:bow: