23.04.2016, 20:19
Hallo,
Ich brauchen Hilfe von einen Profi!
Wie kann ich an einen If 2 Bedingungen verbinden das er nur einen Text schreibt wenn beide zutreffen!
Anbei meine aktuelle Formel er nimmt immer nur eine und ich weiß nicht wo ran das liegt! ICH bin noch ganz frisch auf dem Gebiet :)
danke
Sub formel_ex()
Dim i As Integer
Dim letzteZeile As Integer
Selection.SpecialCells(xlCellTypeLastCell).Select
letzteZeile = ActiveCell.Row
For i = 4 To letzteZeile
If Cells(i, 1) = "EX" And Cells(i, 2) = "Zentrale" Then
Cells(i, 6).FormulaLocal = "Expert Zentrale"
End If
If Cells(i, 1) = "RED" And Cells(i, 2) = "Zentrale" Then
Cells(i, 6).FormulaLocal = "RED ZAC Zentrale"
End If
If Cells(i, 1) = "EP" And Cells(i, 2) = "Zentrale" Then
Cells(i, 6).FormulaLocal = "EP Zentrale"
End If
If Cells(i, 1) = "" Then
Cells(i, 6).FormulaLocal = "leer"
End If
If Cells(i, 1) = "EX" Then
Cells(i, 6).FormulaLocal = "Expert"
End If
If Cells(i, 1) = "RED" Then
Cells(i, 6).FormulaLocal = "RED ZAC"
End If
If Cells(i, 1) = "EP" Then
Cells(i, 6).FormulaLocal = "EP"
End If
Next i
End Sub
Ich brauchen Hilfe von einen Profi!
Wie kann ich an einen If 2 Bedingungen verbinden das er nur einen Text schreibt wenn beide zutreffen!
Anbei meine aktuelle Formel er nimmt immer nur eine und ich weiß nicht wo ran das liegt! ICH bin noch ganz frisch auf dem Gebiet :)
danke
Sub formel_ex()
Dim i As Integer
Dim letzteZeile As Integer
Selection.SpecialCells(xlCellTypeLastCell).Select
letzteZeile = ActiveCell.Row
For i = 4 To letzteZeile
If Cells(i, 1) = "EX" And Cells(i, 2) = "Zentrale" Then
Cells(i, 6).FormulaLocal = "Expert Zentrale"
End If
If Cells(i, 1) = "RED" And Cells(i, 2) = "Zentrale" Then
Cells(i, 6).FormulaLocal = "RED ZAC Zentrale"
End If
If Cells(i, 1) = "EP" And Cells(i, 2) = "Zentrale" Then
Cells(i, 6).FormulaLocal = "EP Zentrale"
End If
If Cells(i, 1) = "" Then
Cells(i, 6).FormulaLocal = "leer"
End If
If Cells(i, 1) = "EX" Then
Cells(i, 6).FormulaLocal = "Expert"
End If
If Cells(i, 1) = "RED" Then
Cells(i, 6).FormulaLocal = "RED ZAC"
End If
If Cells(i, 1) = "EP" Then
Cells(i, 6).FormulaLocal = "EP"
End If
Next i
End Sub