doctortt
04-30-2011, 07:28 PM
Hi, what's wrong with my codes?
I have two radio buttons. If a user selects optionbutton1, then it will shade Range("G7:G20") otherwise, shade a different range.
But then I click the radio button, nothing happens.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If OptionButton1.Value = True Then
Range("F7:G20").Select
With Selection.Interior
.Pattern = xlLightDown
.PatternColorIndex = xlAutomatic
.ColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
Range("C7:D20").Select
With Selection.Interior
.Pattern = xlLightDown
.PatternColorIndex = xlAutomatic
.ColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
I have two radio buttons. If a user selects optionbutton1, then it will shade Range("G7:G20") otherwise, shade a different range.
But then I click the radio button, nothing happens.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If OptionButton1.Value = True Then
Range("F7:G20").Select
With Selection.Interior
.Pattern = xlLightDown
.PatternColorIndex = xlAutomatic
.ColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
Range("C7:D20").Select
With Selection.Interior
.Pattern = xlLightDown
.PatternColorIndex = xlAutomatic
.ColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If