Makro mit Schleife optimieren
01.03.2007 17:00:39
Wolfgang
ich habe mir dieses Makro geschrieben, um eine Abfrage zu starten. Mit folgender Bedingung .
Wenn in Tabelle2 (A1) das Jahr 2007 steht, dann in Zelle (EP29) = (BG42) eintragen. Bei dem Jahr 2008 (EQ29) = (BG42) usw. bis zum Jahr 2020.
Wie schreibt daraus eine For Next - Schleife?
If Tabelle2.Cells(1, 1) = "2007" Then
[EP2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2008" Then
[EQ2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2009" Then
[ER2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2010" Then
[ES2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2011" Then
[ET2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2012" Then
[EU2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2013" Then
[EV2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2014" Then
[EW2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2015" Then
[EX2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2016" Then
[EY2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2017" Then
[EZ2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2018" Then
[FA2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2019" Then
[FB2] = [BG42]
Else
If Tabelle2.Cells(1, 1) = "2020" Then
[FC2] = [BG42]
Else
'[BI42] = [BG42]
'[I43] = [BI42]
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Vielen Dank schon mal im vorraus und Gruß
Wolfgang