Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1112to1116
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

Enden

Enden
serge
Hallo leute
Mit folgendem Makro rufe ich ein Formular auf
Sub commandbutton()
Sadresse = Selection.Address(RowAbsolute:=False, columnAbsolute:=False)
If Application.CountA(Range(Sadresse)) > 0 Then
MsgBox ("In der ausgwählten Zeitspanne besteht schon ein Termin!")
Else
Dim wahl
ActiveSheet.Unprotect Password:="smart"
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Sadresse = Selection.Address(RowAbsolute:=False, columnAbsolute:=False)
wahl = MsgBox("Wollen Sie im ausgewähltem Bereich " & vbCrLf & vbCrLf & " " & Selection.Address(RowAbsolute:=False, columnAbsolute:=False) & " " & vbCrLf & vbCrLf & " einen Termin festlegen?", vbYesNo, "Termin einfügen!")
Application.ScreenUpdating = True
If wahl = vbYes Then
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
Übersicht.Show ActiveSheet.Protect Password:="smart", DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Labtopbeamer").Select
Range(Sadresse).Select
CommandButtonpc
Else
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
ActiveSheet.Protect Password:="smart", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End If
End Sub
wenn ich nun dieses Formular abbrech mit:

Private Sub CommandButton3_Click()
Application.EnableEvents = False
Unload Me
Application.EnableEvents = True
End Sub

möchte ich das Makro Sub commandbutton() auch abbrechen!
Wie stelle ich das an?
Im jetzigen Zustand geht mein markro bie
Contents:=True, Scenarios:=True
weiter
danke Serge

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Enden
06.11.2009 12:29:00
xr8k2
Hallo Serge,
ich würd´s evtl mit einer globalen Variable machen ...

Dim Abbr as boolean
Sub commandbutton()
Sadresse = Selection.Address(RowAbsolute:=False, columnAbsolute:=False)
If Application.CountA(Range(Sadresse)) > 0 Then
MsgBox ("In der ausgwählten Zeitspanne besteht schon ein Termin!")
Else
Dim wahl
ActiveSheet.Unprotect Password:="smart"
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Sadresse = Selection.Address(RowAbsolute:=False, columnAbsolute:=False)
wahl = MsgBox("Wollen Sie im ausgewähltem Bereich " & vbCrLf & vbCrLf & " " & Selection.Address( _
RowAbsolute:=False, columnAbsolute:=False) & " " & vbCrLf & vbCrLf & " einen Termin festlegen?", vbYesNo, "Termin einfügen!")
Application.ScreenUpdating = True
If wahl = vbYes Then
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
Übersicht.Show
if abbr then exit sub
ActiveSheet.Protect Password:="smart", DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Labtopbeamer").Select
Range(Sadresse).Select
CommandButtonpc
Else
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
ActiveSheet.Protect Password:="smart", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End If
End Sub
Private Sub CommandButton3_Click()
abbr = true
Application.EnableEvents = False
Unload Me
Application.EnableEvents = True
End Sub

Gruß,
xr8k2
Anzeige
AW: Enden
06.11.2009 12:29:44
Rudi
Hallo,
1. definiere eine Public-Variable
Public blnCancel as Boolean
2.
Private Sub CommandButton3_Click()
Application.EnableEvents = False
blnCancel=True
Unload Me
Application.EnableEvents = True
End Sub

3.
........
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
Übersicht.Show
If blnCancel Then
blnCancel=False
Exit Sub
End If

ActiveSheet.Protect Password:="smart", DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Labtopbeamer").Select
Range(Sadresse).Select
CommandButtonpc
.......
Gruß
Rudi
Anzeige
Danke an beide, es klappt! owT
06.11.2009 17:01:58
serge

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige