| Einheitliche Gestaltung der Kommentar-Eigenschaften |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| Kommentar hinzufügen: Bei Eingabe in A5 wird das Doppelte als Kommentar hinzugefügt. | |
| 200 | | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| Kommentar-Eigenschaften ändern: Schriftart und -größe werden aus A10 und A11 übernommen. | |
| Kommentar-Eigenschaften sofort ändern | | Farbzahlen: | | |
| Courier | = Schriftart | | | | 0 | 10 | 20 | 30 | 40 | 50 | | |
| 18 | = Schriftgröße | | | | 1 | 11 | 21 | 31 | 41 | 51 | | |
| 18 | = Schriftfarbe | | | | 2 | 12 | 22 | 32 | 42 | 52 | | |
| | | | | 3 | 13 | 23 | 33 | 43 | 53 | | |
| | | | | 4 | 14 | 24 | 34 | 44 | 54 | | |
| | | | | 5 | 15 | 25 | 35 | 45 | 55 | | |
| | | | | 6 | 16 | 26 | 36 | 46 | 56 | | |
| Kommentar-Eigenschaften ändern | | 7 | 17 | 27 | 37 | 47 | | | |
| | | | | 8 | 18 | 28 | 38 | 48 | | | |
| | | | | 9 | 19 | 29 | 39 | 49 | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| Inhalt des VBA-Moduls: | | | | | | | | |
| Sub auto_open() | | | | | | | | |
| Application.OnEntry = "Kommentar" | Makro läuft immer, wenn eine Änderung in irgend einer Zelle erfolgt. |
| End Sub | | | | | | | | |
| | | | | | | | |
| Sub Kommentar() | Einfügen eines Kommentars bei der Eingabe in A5. |
| Dim ergebnis$ | Als Kommentar wird das Doppelte des Zellwertes in A5 eingefügt. |
| If ActiveCell.Address = "$A$5" Then | | | | | | | | |
| [a5].ClearComments | | | | | | | | |
| [a5].AddComment | | | | | | | | |
| If Not IsNumeric([a5]) Then ergebnis = "Keine Zahl!" _ | | | | | | | | |
| Else ergebnis = CStr(Funktionsname([a5].Value)) | | | | | | | | |
| [a5].Comment.Text Text:=ergebnis | | | | | | | | |
| Call aendern | | | | | | | | |
| ElseIf ActiveCell.Address = "$A$10" Then | | | | | | | | |
| Call kommentare_aendern | Schriftart. |
| ElseIf ActiveCell.Address = "$A$11" Then | | | | | | | | |
| Call kommentare_aendern | Schriftgröße |
| ElseIf ActiveCell.Address = "$A$12" Then | | | | | | | | |
| Call kommentare_aendern | Schriftfarbe |
| End If | | | | | | | | |
| End Sub | | | | | | | | |
| | | | | | | | |
| Function Funktionsname(Zelle) | | | | | | | | |
| Funktionsname = Zelle & " * 2 = " & Zelle * 2 | | | | | | | | |
| End Function | | | | | | | | |
| | | | | | | | |
| Sub auto_close() | Makro muß auch wieder geschlossen werden, sonst |
| Application.OnEntry = "" | läuft es auch auf anderen Workbooks. |
| End Sub | | | | | | | | |
| | | | | | | | |
| Sub kommentare_aendern() | Ändern von Kommentar-Eigenschaften. |
| Dim Zelle, ersteAdresse | | | | | | | | |
| Set Zelle = Cells.Find(What:="*", LookIn:=xlComments) | Ersten Kommentar finden. |
| If Not Zelle Is Nothing Then | | | | | | | | |
| ersteAdresse = Zelle.Address | | | | | | | | |
| Range(ersteAdresse).Activate | Aktiviert gefundene Zelle mit Kommentar. |
| Call aendern | Kommentar-Eigenschaften der Zelle wird geändert. |
| Do | Weitere Kommentare finden. |
| Set Zelle = Cells.FindNext(Zelle) | | | | | | | | |
| If Zelle.Address = ersteAdresse Then Exit Do | | | | | | | | |
| Range(Zelle.Address).Activate | | | | | | | | |
| Call aendern | | | | | | | | |
| Loop While Not Zelle Is Nothing And Zelle.Address <> _ | | | | | | | | |
| ersteAdresse | | | | | | | | |
| End If | | | | | | | | |
| Range("a1").Select | Bei Klick auf den Button. |
| End Sub | | | | | | | | |
| | | | | | | | |
| Sub aendern() | Kommentar-Eigenschaften der Zelle wird geändert. |
| Dim schriftart$, schriftgroesse%, schriftfarbe% | | | | | | | | |
| schriftart = [a10] | Schrift aller Kommentare anpassen. |
| schriftgroesse = [a11] | | | | | | | | |
| schriftfarbe = [a12] | | | | | | | | |
| On Error GoTo Fehler | | | | | | | | |
| With ActiveCell | | | | | | | | |
| .Comment.Visible = True | | | | | | | | |
| .Comment.Shape.Select True | | | | | | | | |
| Selection.Font.Name = schriftart | Schriftart. |
| Selection.Font.Size = schriftgroesse | Schriftgröße. |
| Selection.Font.ColorIndex = schriftfarbe | Schriftfarbe. |
| Selection.Font.Bold = True | Fett |
| Selection.AutoSize = True | Automatische Größe. |
| End With | | | | | | | | |
| Fehler: | | | | | | | | |
| Exit Sub | | | | | | | | |
| End Sub | | | | | | | | |
| | | | | | | | | | | | |