AW: Letzte Zelle suchen und überall Formel eintra
05.03.2018 15:01:42
Werner
Hallo Albin,
und wo hast du da WENNFEHLER mit drin?
Sub Formeln_Spalte_B_und_C()
Dim wks As Worksheet
Dim Zei_L As Long
Set wks = ActiveSheet
Application.Calculation = xlCalculationManual
With wks
Zei_L = .Cells(.Rows.Count, 1).End(xlUp).Row
If Zei_L >= 2 Then
With .Range(.Cells(2, 1), .Cells(Zei_L, 1))
If Application.WorksheetFunction.CountBlank(.Cells) = 0 Then
' erster Text Links holen bis - Zeichen. (0, 5) für Eintrag Spalte F [2] _
Quele - Wert holen +2 Spalten rechts
.Offset(0, 4).FormulaR1C1 = _
"=IFERROR(LEFT(RC[2],FIND(""-"",RC[2])-1),"""")"
' zweiter Text Rechts holen ab - Zeichen. (0, 6) für Eintrag Spalte g [1] _
Quele - Wert holen +1 Spalten rechts
.Offset(0, 5).FormulaR1C1 = _
"=IFERROR(RIGHT(RC[1],LEN(RC[1])-FIND(""-"",RC[1])),"""")"
Else
'Leerzellen in Spalte A überspringen
With .SpecialCells(xlCellTypeConstants)
.Offset(0, 4).FormulaR1C1 = _
"=IFERROR(LEFT(RC[2],FIND(""-"",RC[2])-1),"""")"
.Offset(0, 5).FormulaR1C1 = _
"=IFERROR(RIGHT(RC[1],LEN(RC[1])-FIND(""-"",RC[1])),"""")"
End With
End If
End With
End If
End With
Application.Calculation = xlCalculationAutomatic
End Sub
Gruß Werner