Consulting

Results 1 to 3 of 3

Thread: Solved: Radio button is not working.

  1. #1

    Solved: Radio button is not working.

    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("C720").Select
    With Selection.Interior
    .Pattern = xlLightDown
    .PatternColorIndex = xlAutomatic
    .ColorIndex = xlAutomatic
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    End If

  2. #2
    If fixed it.

    Private Sub OptButton1()
    Range("XXXXX").Interior.Pattern = xlLightDown
    Range("xxxxx").Interior.Pattern = xlSolid
    End If
    End Sub
    Private Sub OpButton2()
    Range("xxxxx").Interior.Pattern = xlLightDown
    Range("xxxxx").Interior.Pattern = xlSolid

    End Sub

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You are repeating that code, just assigning a different property. Doesn't seem right to me.

    And can't you start using code tags?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •