kann mir jemand erklären, wie ich ein Makro über die Taste Enter starten kann? Zudem sollte das Makro nur dann ausgeführt werden wenn ich in einer bestimmten Zelle stehe, bzw. in einer bestimmten Spalte. Sonst würde sich das Makro ja jedesmal starten wenn Enter betätigt wird. Und das sollte nicht passieren.
Zusätzlich hier noch der bereit vorhandene Cuellcode: (allerdings nicht von mir erstellt)
Option Explicit
Sub GuardusMWAus()
Dim SN As String
Dim Trenn As String
Dim Pos As Range
Dim GFname As String
Dim GPath As String
Dim FContent As String
Trenn = ";"
Set Pos = Application.ActiveCell
FContent = Trenn & Format(Cells(Pos.Row, 5).Value, "YYYYMMDD") 'datum
FContent = FContent & Format(Cells(Pos.Row, 6).Value, "HHMMSS") 'uhrzeit
FContent = FContent & Trenn & Cells(Pos.Row, 1).Value 'Messwert1 Spannung Messrichtung
FContent = FContent & Trenn & Cells(Pos.Row, 2).Value 'Messwert2 Spannung Gegenrichtung
FContent = FContent & Trenn & Cells(Pos.Row, 9).Value 'Messwert3 Differenz
FContent = FContent & Trenn
SN = Cells(Pos.Row, 7).Value
FContent = Replace(FContent, ",", ".")
GFname = "RW" & SN & ".txt"
GPath = "c:\GMesswert\"
Open GPath & GFname For Output As #1
Print #1, FContent
Close #1
'Ausgeführte Zeile formatieren
Range("A2:I2").Select
Range("I2").Activate
With Selection.Interior
.ColorIndex = 50
.Pattern = xlSolid
End With
Selection.Font.Bold = True
Range("J3").Select
End Sub
Also, d.h. Markierung soll auf jetzt ausführen stehen, nun Enter drücken Makro wird ausgeführt dabei die Zeile entsprechend Markiert.