Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1612to1616
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

ActiveCell.FormulaR1C1 = "=RC[-1]"

ActiveCell.FormulaR1C1 = "=RC[-1]"
20.03.2018 12:33:58
Andreas
Hallo,
hätte mal wieder eine Frage.
Wie kann ich folgenden Code kürzer gestalten. (nur einen Block reinkopiert)
Hab schon rumprobiert aber bin mit meinem sehr bescheidenen VBA Latein am Ende.
Dieser Code soll folgendes bewirken:
In Zelle AK13 steht einfach =AJ13 (nötig für eine Berechnung)
wenn jemand diesen Bezug ändert (in meinem Fall durchaus möglich) soll über das
Makro wieder das =AJ13 stehen, usw.
Jetzt habe ich aber in einem Tabellenblatt 15 Druckbereiche und in jedem Druckbereich
55 Zellen über das Makro zu ändern, sprich 825 Zellen.
Da schreit jetzt der VBA Editor "Prozedur zu groß".
Bin mir sicher ihr könnt mir einen Rat geben.
Vielen Dank
LG Andi
'Ma 02
Range("AK13").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK14").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK15").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK16").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK17").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK18").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK19").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK20").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK21").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK22").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK23").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK24").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK25").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK26").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK27").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK28").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK29").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK30").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK31").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK32").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK33").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK34").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK35").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK36").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK37").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK38").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK39").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK40").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK41").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK42").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK43").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK44").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK45").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK46").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK47").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK48").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK49").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK50").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK51").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK52").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK53").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK54").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK55").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK57").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK58").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK59").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK60").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK61").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK62").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK63").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK64").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK65").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK66").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK67").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("AK68").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: ActiveCell.FormulaR1C1 = "=RC[-1]"
20.03.2018 12:42:18
Werner
Hallo Andreas,
so:
Public Sub aaa()
Range("AK13:AK68").ClearContents
Range("AK13:AK68").FormulaR1C1 = "=RC[-1]"
End Sub
Gruß Werner
AW: ActiveCell.FormulaR1C1 = "=RC[-1]"
20.03.2018 12:42:35
Rudi
Hallo,
Ohne Select und ClearContents:
Range("AK13:AK68").Formular1c1="=RC[-1]
Gruß
Rudi
AW: ActiveCell.FormulaR1C1 = "=RC[-1]"
20.03.2018 12:47:50
Daniel
Hi
1. es ist nicht notwendig, eine Zelle zu selektieren und dann mit der Selektion den Befehl auszuführen.
man kann auch den Befehl direkt auf die Zelle anwenden:
Range("AK13").ClearContents
2. Wenn du eine Zelle mit Inhalt füllst, ist es nicht notwendig sie vorher zu leeren.
Das ClearContents kann entfallen:
dh aus
Range("AK13").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "=RC[-1]"

Wird die Zeile:
Range("AK13").FormulaR1C1 = "=RC[-1]"
3. Wenn man für mehrere direkt nebeneinander liegende Zellen die gleiche Aktion ausführt, dann kann man das in einem Schritt tun:
Range("AK13:AK68").FormulaR1C1 = "=RC[1]"

Gruß Daniel
Anzeige
AW: ActiveCell.FormulaR1C1 = "=RC[-1]"
20.03.2018 13:03:05
Andreas
Hallo Daniel, Werner und Rudi,
danke für eure Antworten, hab wieder dazugelernt.
Schönen Tag euch noch,
LG Andi!
Gerne u. Danke für die Rückmeldung. o.w.T.
20.03.2018 16:36:17
Werner

300 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige