Ich habe in der Spalte A einige Wagennummern stehen. z.B. 3180 5359 444-9
Nun brauch ich Makro das in der Spalte A alle Wagen so erscheinen 318053594449 ohne eine neue Spalte anzulegen, geht das?
Danke in Voraus.
Option Explicit
Sub umw()
Dim zz As Long
Const intC = 1
For zz = 2 To Cells(Rows.Count, intC).End(xlUp).Row
Cells(zz, intC + 1) = 1 * Replace(Replace(Cells(zz, intC), " ", ""), "-", "")
Cells(zz, intC) = Replace(Replace(Cells(zz, intC), " ", ""), "-", "")
Next zz
End Sub
Im Beispiel entsteht (nach Kopie der Werte aus Spalte D in Spalte A) das:A | B | C | D | E | F | G | |
1 | neu Text | neu Zahl | alt | Spalte | Zahlformat | ||
2 | 318053594449 | 318053594449 | 3180 5359 444-9 | A | Text | ||
3 | 018053594449 | 018053594449 | 0180 5359 444-9 | B | 000000000000 | ||
4 | 1234567820 | 001234567820 | 12 3456 78-20 | D | Text | ||
5 | 00123456782 | 000123456782 | 0012 3456 78-2 | ||||
6 | 999999999999 | 999999999999 | 9999 9999 999-9 |
Sub umw()
Dim zz As Long
Const intC = 1
Columns(intC).NumberFormat = "000000000000"
For zz = 2 To Cells(Rows.Count, intC).End(xlUp).Row
Cells(zz, intC) = 1 * Replace(Replace(Cells(zz, intC), " ", ""), "-", "")
Next zz
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort