Gruppe
Dialog
Problem
Wie kann ich über ein UserForm-RefEdit-Steuerelement einen Bereich auswählen und für den ausgewählten Bereich eine bedingte Formatierung festlegen?
ClassModule: frmFormatierung
Private Sub cmdFormat_Click()
With Range(refFormat.Value)
.FormatConditions.Delete
.Range(refFormat.Value).Cells(1).Activate
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=WOCHENTAG(" & Range(refFormat.Value).Cells(1, 1) _
.Address(False, False) & ")=7"
.FormatConditions(1).Interior.ColorIndex = 35
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=WOCHENTAG(" & Range(refFormat.Value).Cells(1, 1) _
.Address(False, False) & ")=1"
.FormatConditions(2).Interior.ColorIndex = 42
End With
Unload Me
End Sub
Private Sub cmdWeiter_Click()
Unload Me
End Sub
StandardModule: basMain
Sub CallForm()
frmFormatierung.Show
End Sub