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

Schaltfläche Makro zuweisen + aufzeichnen

Schaltfläche Makro zuweisen + aufzeichnen
Isolde
Hallo Excel-Profis,
folgendes habe ich mit dem Makrorekorder aufgezeichnet
wie ich mit dem Zeichen-Tool Rechteck eine Schaltfläche erzeuge und dieser per Rechtsklick das Makro: "Makro37_AlleAnzeigen" zuweise.
Das Erzeugen der Schaltfläche funktioniert automatisch, allerdings mekkert Excel bei der Zuweisung des Makros rum:
Es ist die vorletzte Zeile des Codes welche „debuggt“ wird:

Selection.OnAction = "Makro37_AlleAnzeigen"
Range("BW2").Select
End Sub
Es wäre toll, wenn mir da jemand weiter helfen könnte!!!
LG Isolde

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Schaltfläche Makro zuweisen + aufzeichnen
28.10.2010 14:20:01
Rudi
Hallo,
versuch das mal so:
Sub Makro1()
Dim myShape As Shape
Set myShape = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 30, 60, 50, 25)
With myShape
With .OLEFormat.Object
.Caption = "Makro 37"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Name = "Makro 37"
End With
.OnAction = "Makro37_AlleAnzeigen"
End With
End Sub

Gruß
Rudi
Danke und Frage
28.10.2010 16:47:16
Isolde
Hallo Rudi,
mit Hilfe Deines Makros habe ich jetzt so lange laienhaft an meinem Makro herumexperementiert, so dass es jetzt endlich richtig funktioniert!!! DANKE!
Dein Makro konnte ich nicht so komplett übernehmen, weil meine Schaltfläche ja ganz anders aussehen soll und anders positioniert ist!!
Kannst du mir bitte sagen wie ich dieses aufgenommene Makro noch vereinfachen kann...also ohne diese überflüssigen Befehle?
Hier das Makro was Schaltfläche erstellt und Makro zuweist:
Sub Makro6()
Dim myShape As Shape
Set myShape = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 5738.25, 27.75, 147#, 102#)
With myShape
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.SchemeColor = 55
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = 64
.Line.BackColor.RGB = RGB(255, 255, 255)
myShape.Select
Selection.Characters.Text = "Alle anzeigen (alle Filter werden zurückgesetzt)"
With Selection.Characters(Start:=1, Length:=13).Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
End With
With Selection.Characters(Start:=14, Length:=35).Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
.Orientation = xlHorizontal
End With
Selection.Characters.Text = "Alle anzeigen" & Chr(10) & " (alle Filter werden zurückgesetzt) _
With Selection.Characters(Start:=1, Length:=14).Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
With Selection.Characters(Start:=15, Length:=35).Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("BX1").Select
Selection.Characters.Text = "Alle anzeigen" & Chr(10) & " (alle Filter werden zurückgesetzt) _
With Selection.Characters(Start:=1, Length:=14).Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
With Selection.Characters(Start:=15, Length:=35).Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
With myShape
.OnAction = "Makro37_AlleAnzeigen"
End With
End Sub

Anzeige
AW: Danke und Frage
28.10.2010 20:03:37
Rudi
Hallo,
das sollte reichen:
Sub Makro6() '
Dim myShape As Shape
Set myShape = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 5738.25, 27.75, 147#, 102#)
With myShape
.Fill.ForeColor.SchemeColor = 55
With .OLEFormat.Object
.Characters.Text = "Alle anzeigen (alle Filter werden zurückgesetzt)"
With .Characters(Start:=1, Length:=13).Font
.Name = "Arial"
.Size = 20
.ColorIndex = 2
End With
With .Characters(Start:=14, Length:=35).Font
.Name = "Arial"
.Size = 10
.ColorIndex = 2
End With
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
.Orientation = xlHorizontal
End With
.OnAction = "Makro37_AlleAnzeigen"
End With
End Sub

Gruß
Rudi
Anzeige
DANKE!! alles SUPER o.w.T
29.10.2010 12:31:41
Isolde

  • 302 Forumthreads zu ähnlichen Themen

    Anzeige
    Anzeige
    Anzeige

    Beliebteste Forumthreads (12 Monate)

    Anzeige

    Beliebteste Forumthreads (12 Monate)

    Anzeige
    Anzeige
    Anzeige