Hi, ich habe die Schleife, etc. jetzt etwas umgebaut.
Ich suche mir die Spaltennummern jetzt auch anhand der Überschriften, um sicher zu sein, falls die mal an einer anderen Stelle stehen.
Ist wahrscheinlich etwas umständlicher als es sein müsste, aber so funktioniert es auf jeden Fall.
Muss mir ggf. nur noch was für's Error Handling einfallen lassen, falls sich in der Datei mal was ändert (z.B. Name einer Überschrift).
Danke dir auf jeden Fall für den Input, den Anstoß hab ich gebraucht :-)
Sub Text_ersetzen()
Dim val_MontArt, val_Eingspng, val_Schutzart, val_LeistungAC, val_Nennleist, val_Temp, val_GMaterial, val_Breite, val_Hoehe, val_Tiefe, val_Durchm, _
val_Netgew, val_Schutzkl, val_Schlagf, val_Farbe, val_Quersch, val_Lichtstrom, val_Lichtfarbe, val_Lebensd, val_RA, val_ArtText As String
Dim head_MontArt, head_Eingspng, head_Schutzart, head_LeistungAC, head_Nennleist, head_Temp, head_GMaterial, head_Breite, head_Hoehe, head_Tiefe, head_Durchm, _
head_Netgew, head_Schutzkl, head_Schlagf, head_Farbe, head_Quersch, head_Lichtstrom, head_Lichtfarbe, head_Lebensd, head_RA, head_ArtText As String
Dim col_MontArt, col_Eingspng, col_Schutzart, col_LeistungAC, col_Nennleist, col_Temp, col_GMaterial, col_Breite, col_Hoehe, col_Tiefe, col_Durchm, _
col_Netgew, col_Schutzkl, col_Schlagf, col_Farbe, col_Quersch, col_Lichtstrom, col_Lichtfarbe, col_Lebensd, col_RA, col_ArtText As Integer
Dim i, last_row, head_row, first_row, loop_row, cl, repl_cl As Long
'Überschriften finden, Spalten rausschreiben und letzte Zeile finden
head_MontArt = "Montageart DE"
head_Eingspng = "Eingangsspannung | -frequenz DE"
head_Schutzart = "Schutzart"
head_LeistungAC = "Max. Leistung"
head_Nennleist = "Nennleistung Leuchtmittel"
head_Temp = "Umgebungstemperatur"
head_GMaterial = "Gehäusematerial DE"
head_Breite = "Breite (mm)"
head_Hoehe = "Höhe (mm)"
head_Tiefe = "Tiefe (mm)"
head_Durchm = "Durchmesser (mm)"
head_Netgew = "Nettogewicht (kg)"
head_Schutzkl = "Schutzklasse"
head_Schlagf = "Schlagfestigkeit"
head_Farbe = "Gehäusefarbe (RAL)"
head_Quersch = "Max. Leitungsquerschnitt"
head_Lichtstrom = "Lichtstrom"
head_Lichtfarbe = "Lichtfarbe Leuchtmittel"
head_Lebensd = "Erwartete LED-Lebensdauer (h)"
head_RA = "Farbwiedergabeindex (Ra)"
head_ArtText = "Artikel-Langbeschreibung"
head_row = 1
col_MontArt = Application.WorksheetFunction.Match(head_MontArt, Cells(head_row, 1).EntireRow, False)
col_Eingspng = Application.WorksheetFunction.Match(head_Eingspng, Cells(head_row, 1).EntireRow, False)
col_Schutzart = Application.WorksheetFunction.Match(head_Schutzart, Cells(head_row, 1).EntireRow, False)
col_LeistungAC = Application.WorksheetFunction.Match(head_LeistungAC, Cells(head_row, 1).EntireRow, False)
col_Nennleist = Application.WorksheetFunction.Match(head_Nennleist, Cells(head_row, 1).EntireRow, False)
col_Temp = Application.WorksheetFunction.Match(head_Temp, Cells(head_row, 1).EntireRow, False)
col_GMaterial = Application.WorksheetFunction.Match(head_GMaterial, Cells(head_row, 1).EntireRow, False)
col_Breite = Application.WorksheetFunction.Match(head_Breite, Cells(head_row, 1).EntireRow, False)
col_Hoehe = Application.WorksheetFunction.Match(head_Hoehe, Cells(head_row, 1).EntireRow, False)
col_Tiefe = Application.WorksheetFunction.Match(head_Tiefe, Cells(head_row, 1).EntireRow, False)
col_Durchm = Application.WorksheetFunction.Match(head_Durchm, Cells(head_row, 1).EntireRow, False)
col_Netgew = Application.WorksheetFunction.Match(head_Netgew, Cells(head_row, 1).EntireRow, False)
col_Schutzkl = Application.WorksheetFunction.Match(head_Schutzkl, Cells(head_row, 1).EntireRow, False)
col_Schlagf = Application.WorksheetFunction.Match(head_Schlagf, Cells(head_row, 1).EntireRow, False)
col_Farbe = Application.WorksheetFunction.Match(head_Farbe, Cells(head_row, 1).EntireRow, False)
col_Quersch = Application.WorksheetFunction.Match(head_Quersch, Cells(head_row, 1).EntireRow, False)
col_Lichtstrom = Application.WorksheetFunction.Match(head_Lichtstrom, Cells(head_row, 1).EntireRow, False)
col_Lichtfarbe = Application.WorksheetFunction.Match(head_Lichtfarbe, Cells(head_row, 1).EntireRow, False)
col_Lebensd = Application.WorksheetFunction.Match(head_Lebensd, Cells(head_row, 1).EntireRow, False)
col_RA = Application.WorksheetFunction.Match(head_RA, Cells(head_row, 1).EntireRow, False)
col_ArtText = Application.WorksheetFunction.Match(head_ArtText, Cells(head_row, 1).EntireRow, False)
last_row = Cells(Rows.Count, col_ArtText).End(xlUp).Row
'Schleife zum Austauschen der Variablen
loop_row = 2
For i = loop_row To last_row
'Werte aus den Zellen auslesen
val_MontArt = Cells(loop_row, col_MontArt).Value
val_Eingspng = Cells(loop_row, col_Eingspng).Value
val_Schutzart = Cells(loop_row, col_Schutzart).Value
val_LeistungAC = Cells(loop_row, col_LeistungAC).Value
val_Nennleist = Cells(loop_row, col_Nennleist).Value
val_Temp = Cells(loop_row, col_Temp).Value
val_GMaterial = Cells(loop_row, col_GMaterial).Value
val_Breite = Cells(loop_row, col_Breite).Value
val_Hoehe = Cells(loop_row, col_Hoehe).Value
val_Tiefe = Cells(loop_row, col_Tiefe).Value
val_Durchm = Cells(loop_row, col_Durchm).Value
val_Netgew = Cells(loop_row, col_Netgew).Value
val_Schutzkl = Cells(loop_row, col_Schutzkl).Value
val_Schlagf = Cells(loop_row, col_Schlagf).Value
val_Farbe = Cells(loop_row, col_Farbe).Value
val_Quersch = Cells(loop_row, col_Quersch).Value
val_Lichtstrom = Cells(loop_row, col_Lichtstrom).Value
val_Lichtfarbe = Cells(loop_row, col_Lichtfarbe).Value
val_Lebensd = Cells(loop_row, col_Lebensd).Value
val_RA = Cells(loop_row, col_RA).Value
' Montageart: ..i9do2ltftv1equ..
' Eingangsspannung | -frequenz: ..idveufqqutig1u..
On Error Resume Next
Cells(loop_row, col_ArtText).Value = Replace(Cells(loop_row, col_ArtText).Value, "..i9do2ltftv1equ..", val_MontArt) 'Entsprechende Variable durch spezifischen Wert ersetzen
Cells(loop_row, col_ArtText).Value = Replace(Cells(loop_row, col_ArtText).Value, "..idveufqqutig1u..", val_Eingspng)
'.
'.
'.
'.
loop_row = loop_row + 1 'Schleife um 1 hochzählen
Next i
End Sub