Hallöchen,
für die Theorie kann man schon mal den Makrorekorder anwerfen
Da bekommt man in etwa so etwas:
Code:
Sub Makro1()
'
' Makro1 Makro
'
'
ActiveCell.FormulaR1C1 = "?berschrift" & Chr(10) & "Willi Bald"
With ActiveCell.Characters(Start:=1, Length:=0).Font
.Name = "Calibri"
.FontStyle = "Standard"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=1, Length:=11).Font
.Name = "Calibri"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=12, Length:=11).Font
.Name = "Calibri"
.FontStyle = "Standard"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Range("A6").Select
End Sub
Auf das wesentliche gekürzt wird es etwas übersichtlicher:
Code:
Sub Makro1()
ActiveCell.FormulaR1C1 = "?berschrift" & Chr(10) & "Willi Bald"
With ActiveCell
.Characters(Start:=1, Length:=11).Font.FontStyle = "Fett"
.Characters(Start:=12, Length:=11).Font.FontStyle = "Standard"
End With
End Sub
Damit das flexibel wird und auf die geänderte Zelle reagiert, würde es so aussehen. Voraussetzung dabei ist ein manueller Zeilenvorschub in der Zelle (ALT+ENTER).
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Variablendeklaration, Integer
Dim iStart%
'Mit der aktiven Zelle
With ActiveCell
'Position Zeilenvorschub finden
iStart = InStr(1, .Value, Chr(10))
'Wenn Position des Zeonvorschubs >0, dann
If iStart > 0 Then
'Bis zum Zeilenvorschub Fett formatieren
.Characters(Start:=1, Length:=iStart).Font.FontStyle = "Fett"
'Ab nach dme zeilenvorschub normal formatieren
.Characters(Start:=iStart + 1, Length:=111).Font.FontStyle = "Standard"
'Ende Wenn Position des Zeonvorschubs >0, dann
End If
'Ende Mit der aktiven Zelle
End With
End Sub
Letzte Aufgabe wäre nun noch das Makro auf den Bereich oder die Zelle zu begrenzen, wo es wirken soll