LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Script works in forms element but doesn't in normal option but

Works perfectly. Thanks for clarifying the difference, I'll keep it in mind.

"Peter T" wrote:

Sheets("Voorbeeldportefeuille").Select
*Columns("H:K").Select*


You need to qualify Columns("H:K") with the sheet reference. Normally
without the reference the activesheet is implied, but as your code is in a
worksheet module the code tries to select those columns in its own sheet.
But it can't because it's no longer active. Instead try

Sheets("Voorbeeldportefeuille").Columns("H:K").Sel ect

Actually you really don't need to select, simply

Sheets("Voorbeeldportefeuille").Columns("H:K").Ent ireColumn.Hidden = False

(you don't even need to activate the sheet to do the above)

Regards,
Peter T


If the worksheet module with your code does not "Voorbeeldportefeuille" you
will need t
"CalamityJane" wrote in message
...
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.







 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert comments on Option Button of Forms Toolbar Rechie Excel Discussion (Misc queries) 2 March 14th 10 11:26 AM
Option Button on Forms Toolbar admannj Excel Discussion (Misc queries) 4 January 25th 05 01:07 AM
RefEdits and normal forms / forms in a DLL David Welch Excel Programming 0 December 1st 04 03:49 PM
Option Button Macro (Forms Toolbar) AG[_5_] Excel Programming 3 July 16th 04 02:05 AM
Option Button and forms paradise Excel Programming 1 October 27th 03 12:32 PM


All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"