AW: Noch eine Bitte an Georg
10.11.2005 13:13:56
GeorgK
Hallo Heinz,
folgendes Makro (Tabellenblatt)läuft bei mir einwandfrei:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("I1")) Is Nothing Then Druck1
If Not Intersect(Target, Range("I45")) Is Nothing Then Druck2
' ein bestimmter Bereich darf nicht ausgewählt werden
Dim RaBereich As Range, RaZelle As Range
Set RaBereich = Range("O3")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E3").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O47")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E47").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O91")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E91").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O135")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E135").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O179")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E179").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O223")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E223").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O267")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E267").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O311")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E311").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O355")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E355").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O399")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E399").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O443")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E443").Select
Exit For
End If
Next RaZelle
Set RaBereich = Range("O487")
For Each RaZelle In Range(Target.Address)
If Intersect(RaZelle, RaBereich) Is Nothing Then
Else
Range("E487").Select
End If
Next RaZelle
' ActiveSheet.Unprotect
' ActiveSheet.protect
End Sub
Es geht immer nur einmal "....Worksheet_SelectionChange..."
Trotzdem kommt in Deiner Datei die Fehlermeldung ...Bibliothek.. nicht vorhanden.
Schau mal unter Verweise, ob Du da auch alles aktiviert hast.
Grüße
Georg