LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form Check Boxes an a worksheet

Do it this way:

ActiveSheet.Columns("D:H").Hidden = (ActiveSheet.CheckBoxes( _
"Check Box 1").Value and 1)

if checked, then they will be hidden; unchecked, unhidden

? xlon and 1
1
? xloff and 1
0

to reverse the sense

ActiveSheet.Columns("D:H").Hidden = not cbool (ActiveSheet.CheckBoxes( _
"Check Box 1").Value and 1)

? not cbool(xlOn and 1)
False
? not cbool(xloff and 1)
True

--
Regards,
Tom Ogilvy


"Kevin McCartney" wrote in
message ...
Cheers Chijanzen

The -4146 obviously come from the xl constant xlOff.

Thanks again
regards
KM

"chijanzen" wrote:

Kevin :

try,

If ActiveSheet.CheckBoxes("Check Box 1").Value = xlOn Then
ActiveSheet.Columns("D:H").Hidden = True
End If

--
???,???????
???,???????

http://www.vba.com.tw/plog/


"Kevin McCartney" wrote:

Hi TWIMC,

can someone please tell me why the following line of code doesn't

return the
most logical value when a check box is unchecked,

ActiveSheet.CheckBoxes("Check Box 1").Value

Instead of retunring the expected value 0 it returns -4146. If I set a
Linked cell then I do get FALSE and TRUE appearing but I want to

reference
the value of the Check Box not the cell.

I want to reference the value of the check box for the following line

of code.

ActiveSheet.Columns("D:H").Hidden = ActiveSheet.CheckBoxes("Check Box
1").Value, it works to hide but does't to unhide.

Thanks in advance
KM





 
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
VBA for form check boxes dicko1 Excel Worksheet Functions 4 June 5th 09 04:02 PM
copy check boxes (made from form toolbar) hoffjero Excel Discussion (Misc queries) 6 February 4th 09 11:20 PM
VBA code for the Check Boxes in a form HKS Excel Discussion (Misc queries) 3 June 24th 08 09:42 PM
How do I create a Form with check boxes in Excel Not Super User Excel Worksheet Functions 1 June 28th 07 05:08 PM
Can I Group Form Check Boxes? JK Excel Programming 1 August 23rd 04 07:02 PM


All times are GMT +1. The time now is 07:22 PM.

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"