kleine Code-Modifikation für Prefix Erweiterung
04.11.2008 13:06:11
Eddie
ich will gerne folgenden CODE etwas erweitern, so das ich mit einer ComboBox Ihn Sagen kann, wo er mit den Zählen anfangen soll (also einen Anfangswert für Zahlen, aber auch Buchstaben)
Public Sub PrefixZahl()
Dim WkSh As Worksheet
Dim lZeile As Long
Dim iLfdNr As Long
Set WkSh = ThisWorkbook.Worksheets("Tabelle1") ' den Tabellenblattnamen ggf. anpassen !!!
For lZeile = 1 To WkSh.Cells(Rows.Count, 1).End(xlUp).Row
If WkSh.Cells(lZeile, 1).Value "" Then
iLfdNr = iLfdNr + 1
WkSh.Cells(lZeile, 1).Value = Format(iLfdNr, "000") & " | " & _
WkSh.Cells(lZeile, 1).Value
End If
Next lZeile
End Sub
Public Sub PrefixBuchstabe()
Dim WkSh As Worksheet
Dim lZeile As Long
Dim iLfdNr As Long
Set WkSh = ThisWorkbook.Worksheets("Tabelle1") ' den Tabellenblattnamen ggf. anpassen !!!
For lZeile = 1 To WkSh.Cells(Rows.Count, 1).End(xlUp).Row
If WkSh.Cells(lZeile, 1).Value "" Then
iLfdNr = iLfdNr + 1
WkSh.Cells(lZeile, 1).Value = "_" & _
Application.Substitute(Cells(1, iLfdNr).Address(0, 0), 1, "") & _
" | " & WkSh.Cells(lZeile, 1).Value
End If
Next lZeile
End Sub
Müsste ja die Zeile in einer andere Abfrage umwandeln, nur wie ?
iLfdNr = iLfdNr + 1
Danke und Gruß
der Eddie