View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
CalamityJane CalamityJane is offline
external usenet poster
 
Posts: 2
Default Script works in forms element but doesn't in normal option button

Hello,

I'm programming a Macro to hide/unhide some entire rows and colums, but the
following proble occurs:

When I add the following script to the option button from controls, it
displays an error in line 3 (in the example marked with *):

Private Sub OptionButton1_Change()
If OptionButton1.Value = True Then
Sheets("Voorbeeldportefeuille").Select
*Columns("H:K").Select*
Selection.EntireColumn.Hidden = False
Else
Sheets("Invoer").Select
End If
End Sub

When I use the option button from the Forms toolbar, I get the following
script after recording the macro, and it works perfectly:

Sub Keuzerondje25_BijKlikken() (- = Sub
Optionbutton25_Click())
Sheets("Voorbeeldportefeuille").Select
Columns("H:K").Select
Selection.EntireColumn.Hidden = False
End Sub

Great that it works, but I want to use the option button from the controls
toolbar, as I need to use the change function, in stead of the click
function. Can anyone tell me what I'm doing wrong?

Thanks.