Gross/Kleinschreibung via VBA
08.04.2004 18:26:54
Sabine
weiß irgend jemand wie ich es schaffen kann, den folgendem Code so umzustricken, dass ich bei den if then Blöcken nicht die Umwandlung aller kleinen Buchstaben in große erreiche, sondern nur den ersten Buchstaben in groß wandle und der Rest bleibt wie eingegeben?
Leider sind meine Kenntnisse in VBA noch extrem begrenzt so das ich allein nicht weiter komme.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Bereich As Range
Dim Z
Set Bereich = Range(“C516:BF521,C532:BF537,C548:BF553,C564:BF569,C580:BF585,C596:BF601,C612:BF617,C628:BF633" )
If InStr(Target.Address, ":") = 0 Then
If Intersect(Target, Bereich) Is Nothing Then Exit Sub
Select Case UCase(Target.Value)
Case "T", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10"
Target.Font.ColorIndex = 1
If Target.Column > 2 And Target.Column < 60 And _
Target.Row > 1 And Target.Row < 1000 And Not _
UCase(Target.Value) = Target.Value Then
Target.Value = UCase(Target.Value)
End If
Case Else
With Target
.Font.ColorIndex = 0
End With
End Select
If Target.Value <> "EZU" And Target.Value Like "Z*" Then Target.Font.ColorIndex = 7
If Target.Column > 2 And Target.Column < 60 And _
Target.Row > 1 And Target.Row < 1000 And Not _
UCase(Target.Value) = Target.Value Then
Target.Value = UCase(Target.Value)
End If
Cells(Target.Row - ((Target.Row Mod 16) - 17), Target.Column).Font.ColorIndex = Target.Font.ColorIndex
Else
For Each Z In Selection
Dim S As String
S = Z.Address
If Intersect(Z, Bereich) Is Nothing Then
Else
Select Case UCase(Z.Value)
Case "T", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10"
Z.Font.ColorIndex = 1
If Z.Column > 2 And Z.Column < 60 And _
Z.Row > 1 And Z.Row < 1000 And Not _
UCase(Z.Value) = Z.Value Then
Z.Value = UCase(Z.Value)
End If
Case Else
With Z
.Font.ColorIndex = 0
End With
End Select
If Z.Value <> "EZU" And Z.Value Like "Z*" Then Z.Font.ColorIndex = 7
Cells(Z.Row - ((Z.Row Mod 16) - 17), Z.Column).Font.ColorIndex = Z.Font.ColorIndex
If Z.Column > 2 And Z.Column < 60 And _
Z.Row > 1 And Z.Row < 1000 And Not _
UCase(Z.Value) = Z.Value Then
Z.Value = UCase(Z.Value)
End If
Cells(Z.Row - ((Z.Row Mod 16) - 17), Z.Column).Font.ColorIndex = Z.Font.ColorIndex
End If
Next Z
End If
End Sub