Zellen in makro ansprechen
Hi,
ich hab bisher in meinen Makros die Zellen der Excel Tabelle immer mit Cells(10,3) angesprochen d.h. hier die Zelle C3. Gibt es was wie ich die Zellen auch anders ansprechen kann ohne zählen oder rechnen zu müssen welcher Zahl jetzt der Buchstabe C angehört.
Klar bei C ist es noch einfach aber bei DE?
Danke
Gruß
Georg
Antwort schreiben
Antwort 1 von Arno_Nym vom 12.09.2020, 13:01 Options
Antwort 2 von Arno_Nym vom 12.09.2020, 13:02 Options
Übrigens: Cells(10,3) ist ja eigentlich C10.
Arno
Antwort 3 von Georg123 vom 12.09.2020, 13:30 Options
Hi Danke
ich hab gleich nochmal ne Frage:
Warum sagt Excel hier 'Next ohne For'!?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Tabelle1
Dim i As Integer
For i = 8 To 16
If Cells(5, 25).Value = "Januar" Then
Cells(i, 24).Value = Cells(i, 6).Value - Cells(i, 22).Value
Next i
Antwort 4 von Georg123 vom 12.09.2020, 13:41 Options
Ich glaub ich hab mir die Frage grad selber beantwortet: es fehlt das end if
Antwort 5 von Arno_Nym vom 12.09.2020, 13:47 Options
Und ich wollte grad schreiben:
Entweder du schreibst
if ... then ...
in einer Zeile oder du schließt den if-Block ordentlich ab:
if ...
then ...
end if
Arno
Antwort 6 von Georg123 vom 12.09.2020, 13:51 Options
Hi
kann ich eigentlich auch sowas wie If...then...elseIf....then...elseIf...then...else...
end if?
wenn ja wie funktioniert das richtig da es bei mir nicht funktioniert.
Danke
Gruß
Antwort 7 von Arno_Nym vom 12.09.2020, 18:07 Options
'ne ausführliche Erläuterung führt hier wohl zu weit (ich bin da auch kein guter Lehrer ;o)
Am besten, du setzt im Excel-VBA-Editor den Cursor auf das "if" und drückst F1. Die Excel-Hilfe ist recht ausführlich.
Arno