Supportnet Computer
Planet of Tech

Supportnet / Forum / Tabellenkalkulation

durch TAB in neue Zeile, jedoch mit der gleichen Formatierung!





Frage

HAllo! Frage ob das geht und was man tun muss! Also, ich habe eine große Tabelle mit ferschiednen Formatierungen in der Spalte. Wenn ich nun TAB drücke, dann springt er in die nächste Spalte, wenn ich Enter drücke, dann springt er in die nächste Zeile, bleibt aber in der gleichen Splate. Nun möchte ich, das wenn ich Enter drücke er in eine neue Zeiel springt und zwar dann dort bei A anfängt. ABER gleichzeitig soll er die formatierung von oben übernehmen (zb, in Spalte A Datum (MMM) in Spalte B (ein SVERWEIS) usw. Geht das? Danke

Antwort 1 von JoeKe

Hallo MiMa1979,

folgende Codes in das VBA-Projekt "DieseArbeitsmappe":

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "~"
Application.OnKey "{TAB}"
End Sub

Private Sub Workbook_Open()
Application.OnKey "~", "Formate1"
Application.OnKey "{TAB}", "Formate2"
End Sub


Und folgende in ein Standart Modul:

Option Explicit

Sub Formate1()
Dim Zeile As Long
Zeile = ActiveCell.Row
Cells(Zeile, 1).Copy
Cells(Zeile + 1, 1).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Formate2()
Dim Spalte As Integer, Zeile As Long
Spalte = ActiveCell.Column
Zeile = ActiveCell.Row
If Zeile = 1 Then Exit Sub
Cells(Zeile - 1, Spalte + 1).Copy
Cells(Zeile, Spalte + 1).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub


Es werden aber nur die Formate kopiert. Sverweis ist eine Formel und müsste dann mit "Paste:=xlPasteFormulas" eingefügt werden.


MfG

JöKe

Antwort 2 von MiMa1979

DANKE JöKE,

aber was muss ich tun wenn er beides kopieren soll, also format und formel.

Sprich, wo muss ich
Zitat:
Paste:=xlPasteFormulas


einfügen?

Antwort 3 von JoeKe

Hallo,

mit folgender Änderung wird alles kopiert:

Sub Formate2()
Dim Spalte As Integer, Zeile As Long
Spalte = ActiveCell.Column
Zeile = ActiveCell.Row
If Zeile = 1 Then Exit Sub
Cells(Zeile - 1, Spalte + 1).Copy
Cells(Zeile, Spalte + 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub


Gruß

Ich möchte kostenlos eine Frage an die Mitglieder stellen:


Ähnliche Themen:


Suche in allen vorhandenen Beiträgen: