Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bobm
 
Posts: n/a
Default How do I get Excel to display a range of cells with a check box?

I am trying to get excel to disply a range of cells when a check box is
checked and hide them when it is not checked.
  #2   Report Post  
Casey
 
Posts: n/a
Default How do I get Excel to display a range of cells with a check box?


bobm,

I am not one of the VBA experts, but if your range is in a column and
your checkbox is from the control toolbox and not from the Forms
toolbar this code should work.

Private Sub CheckBox1_Click()
Dim i As Boolean
Dim rng1 As Range

Application.DisplayAlerts = False
i = CheckBox1.Value
Set rng1 = Range("D1:D25") 'Change to suit your needs

If i = True Then
rng1.EntireColumn.Hidden = True
Else
rng1.EntireColumn.Hidden = False
End If
Application.DisplayAlerts = True

End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=478267

  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default How do I get Excel to display a range of cells with a check box?

I put a checkbox from the control toolbox toolbar on a worksheet.

I doubleclicked on that checkbox (named checkbox1) and put this code in that
visible code window:

Option Explicit
Private Sub CheckBox1_Click()
Dim myRng As Range
Set myRng = Me.Range("a10:A20").EntireRow
myRng.Hidden = Me.CheckBox1.Value
End Sub

Then back to excel (click on that design mode icon also on the control toolbox
toolbar) and try checking that box.

bobm wrote:

I am trying to get excel to disply a range of cells when a check box is
checked and hide them when it is not checked.


--

Dave Peterson
Reply
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
Display form from an VB application in Excel kuhni Excel Discussion (Misc queries) 0 August 10th 05 06:04 PM
Cells User Select Locked after upgrade to Excel 2002 TWilson Excel Discussion (Misc queries) 1 August 5th 05 12:22 PM
How do you display Greek and Russian languages in excel? Mark Hayden Excel Discussion (Misc queries) 1 August 1st 05 08:06 AM
How do I merge in a selected range of cells out of Excel? powertots4 Excel Discussion (Misc queries) 1 December 28th 04 08:01 PM
How do I check for duplications in a range of data (excel)? -Adrianna_ Excel Worksheet Functions 2 November 24th 04 10:25 AM


All times are GMT +1. The time now is 06:26 AM.

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

About Us

"It's about Microsoft Excel"