Thema Datum  Von Nutzer Rating
Antwort
08.07.2021 07:36:50 SmileStyle
NotSolved
08.07.2021 09:20:09 Gast79811
NotSolved
08.07.2021 09:21:30 SmileStyle
NotSolved
08.07.2021 09:23:58 Gast66185
NotSolved
08.07.2021 09:32:12 SmileStyle
NotSolved
08.07.2021 09:40:23 Gast57885
NotSolved
08.07.2021 09:42:27 Gast27964
NotSolved
08.07.2021 09:45:59 Gast53676
NotSolved
Rot Kontextmenü Hilfe
08.07.2021 09:52:01 Gast76879
NotSolved
08.07.2021 11:33:40 Gast4572
NotSolved
08.07.2021 11:48:05 Gast4572
NotSolved
08.07.2021 12:29:56 SmileStyle
NotSolved
08.07.2021 12:45:47 Gast4572
NotSolved
08.07.2021 12:51:09 Mase
NotSolved
08.07.2021 14:50:00 SmileStyle
NotSolved
12.07.2021 08:06:36 Gast60839
NotSolved
12.07.2021 13:05:39 Gast67685
NotSolved
12.07.2021 13:51:01 SmileStyle
NotSolved
12.07.2021 17:01:12 Gast31774
NotSolved
13.07.2021 09:49:11 SmileStyle
NotSolved
13.07.2021 12:09:49 Gast31774
NotSolved
13.07.2021 12:14:26 Gast24006
NotSolved
13.07.2021 12:25:41 Gast31774
NotSolved
13.07.2021 12:40:32 Gast80767
NotSolved
13.07.2021 13:08:25 Gast38241
NotSolved
13.07.2021 14:17:30 Gast47257
NotSolved
13.07.2021 14:24:39 SmileStyle
NotSolved
13.07.2021 19:38:48 Gast10209
NotSolved
16.07.2021 06:18:11 SmileStyle
NotSolved
18.07.2021 19:21:12 Gast50788
NotSolved
19.07.2021 08:16:44 SmileStyle
NotSolved
19.07.2021 22:11:38 Gast36161
NotSolved
20.07.2021 08:42:14 SmileStyle
NotSolved
20.07.2021 22:34:34 Gast62425
NotSolved
21.07.2021 06:42:03 SmileStyle
NotSolved

Ansicht des Beitrags:
Von:
Gast76879
Datum:
08.07.2021 09:52:01
Views:
717
Rating: Antwort:
  Ja
Thema:
Kontextmenü Hilfe
Public Sub CreateCommandBar()

  Dim objCommandBar As CommandBar
  Dim objCommandBarButton As CommandBarButton
  Dim objName As Name
  Dim lngIndex As Long

  Call DeleteCommandBar

  Set objCommandBar = CommandBars.Add(Name:=CONTEXT_MENU, _
  Position:=msoBarPopup, Temporary:=True)

  For lngIndex = 1 To 25

      For Each objName In ThisWorkbook.Names

          If objName.Name = "AbwK" & CStr(lngIndex) Then Exit For

      Next

      If Not objName Is Nothing Then

         If Not IsError(Evaluate(objName.RefersTo)) Then

            If Not IsEmpty(Range(objName.Name).Value) Then

               Set objCommandBarButton = objCommandBar.Controls.Add(Type:=msoControlButton)

               With objCommandBarButton

                   .Caption = Range(objName.Name).Value
                   .OnAction = "'Färbe """ & Debug.Print Replace$(objName.Name, InStrRev(objName.Name, "K", Compare:=vbBinaryCompare), "Kk", Count:=1)& """'"

               End With
            End If
         End If
      End If
  Next

  Set objCommandBarButton = Nothing
  Set objCommandBar = Nothing
  Set objName = Nothing

End Sub

Da syntaxfehler

Sub Färbe(ByVal sBereich As String)
     Dim rng As Excel.Range
     ActiveSheet.Protect Password:="KdoSAN", UserInterFaceOnly:=True
 
     For Each rng In Selection
        With rng
           .Interior.Color = Application.Names(sBereich).RefersToRange.Interior.Color
        .Value = Application.Names(sBereich).RefersToRange.Value
        End With
 
     Next
End Sub

und da hängt der Debugger.

Grüße

Wenn du mehr brauchst sag es einfach 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
08.07.2021 07:36:50 SmileStyle
NotSolved
08.07.2021 09:20:09 Gast79811
NotSolved
08.07.2021 09:21:30 SmileStyle
NotSolved
08.07.2021 09:23:58 Gast66185
NotSolved
08.07.2021 09:32:12 SmileStyle
NotSolved
08.07.2021 09:40:23 Gast57885
NotSolved
08.07.2021 09:42:27 Gast27964
NotSolved
08.07.2021 09:45:59 Gast53676
NotSolved
Rot Kontextmenü Hilfe
08.07.2021 09:52:01 Gast76879
NotSolved
08.07.2021 11:33:40 Gast4572
NotSolved
08.07.2021 11:48:05 Gast4572
NotSolved
08.07.2021 12:29:56 SmileStyle
NotSolved
08.07.2021 12:45:47 Gast4572
NotSolved
08.07.2021 12:51:09 Mase
NotSolved
08.07.2021 14:50:00 SmileStyle
NotSolved
12.07.2021 08:06:36 Gast60839
NotSolved
12.07.2021 13:05:39 Gast67685
NotSolved
12.07.2021 13:51:01 SmileStyle
NotSolved
12.07.2021 17:01:12 Gast31774
NotSolved
13.07.2021 09:49:11 SmileStyle
NotSolved
13.07.2021 12:09:49 Gast31774
NotSolved
13.07.2021 12:14:26 Gast24006
NotSolved
13.07.2021 12:25:41 Gast31774
NotSolved
13.07.2021 12:40:32 Gast80767
NotSolved
13.07.2021 13:08:25 Gast38241
NotSolved
13.07.2021 14:17:30 Gast47257
NotSolved
13.07.2021 14:24:39 SmileStyle
NotSolved
13.07.2021 19:38:48 Gast10209
NotSolved
16.07.2021 06:18:11 SmileStyle
NotSolved
18.07.2021 19:21:12 Gast50788
NotSolved
19.07.2021 08:16:44 SmileStyle
NotSolved
19.07.2021 22:11:38 Gast36161
NotSolved
20.07.2021 08:42:14 SmileStyle
NotSolved
20.07.2021 22:34:34 Gast62425
NotSolved
21.07.2021 06:42:03 SmileStyle
NotSolved