heute ist wohl nicht mein bester Vbatag, stoße da auf seltsame Fehler :-(
Option Explicit
Sub Makro1()
Dim zei As Long
For zei = 1 To Range("A65536").End(xlUp).Row
ActiveSheet.Hyperlinks.Add Anchor:=Cells(zei, 2), Address:="c:\download\" & Cells(zei, 1), TextToDisplay:=Cells(zei, 1)
Next zei
End Sub
erzeugt Laufzeitfehler 5.
und bei
DieseArbeitsmappe:
Option Explicit
Private Sub Workbook_Open()
farbe = Range("A1").Interior.ColorIndex
Range("A1").Interior.ColorIndex = 19
Set lastcell = Range("A1")
Wert = Range("A1").Value
Application.EnableEvents = False
Range("A1").Select
Application.EnableEvents = True
End Sub
<b>Tabelle1:</b>
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim Modus As Integer
ActiveSheet.Unprotect
If Target.Count > 1 Then Exit Sub
Wert = lastcell.Value
Modus = Application.CutCopyMode
lastcell.Interior.ColorIndex = farbe
farbe = Target.Interior.ColorIndex
Target.Interior.ColorIndex = 19
Application.EnableEvents = False
Select Case Modus
Case 1
lastcell.Copy Destination:=Target
Modus = 0
Application.CutCopyMode = 0
Target.Interior.ColorIndex = 19
Case 2
lastcell.Cut Destination:=Target
Modus = 0
Application.CutCopyMode = 0
Target.Interior.ColorIndex = 19
End Select
Application.EnableEvents = True
Set lastcell = Target
End Sub
<b>Modul1:</b>
Option Explicit
Public Wert As Variant
Public lastcell As Range
Public farbe As Integer
ist gelegentlich lastcell leer und es gibt ne Fehlermeldung. Mir alles unerklärlich, lastcell wird mit Set "gesetzt" z.B in Workbook_Open und dann im Code, wieso issen die Variable dann irgendwann "leer" ?
Gruß
Reinhard