ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hiding rows with checkbox (https://www.excelbanter.com/excel-programming/330196-hiding-rows-checkbox.html)

Qaspec

hiding rows with checkbox
 
I'm using the following to hide rows from a checkbox. My question is how can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub

Daniel CHEN

hiding rows with checkbox
 
check the checkbox status
if cb1.value = true then
// code for hide
else
// code for unhide
endif
===== * ===== * ===== * =====
Daniel CHEN


www.Geocities.com/UDQServices
Free Data Processing Add-in<

===== * ===== * ===== * =====

"Qaspec" wrote in message
...
I'm using the following to hide rows from a checkbox. My question is how
can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub




Norman Jones

hiding rows with checkbox
 
Hi Qaspec,

Try:

Private Sub CB1_Click()
Range("A10:A30").EntireRow.Hidden = CB1.Value
End Sub


---
Regards,
Norman



"Qaspec" wrote in message
...
I'm using the following to hide rows from a checkbox. My question is how
can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub




STEVE BELL

hiding rows with checkbox
 
Try this. (note that there is no selection needed)

Private Sub CheckBox1_Click()
If CheckBox1 = True Then
Range(Rows(10), Rows(30)).EntireRow.Hidden = True
ElseIf CheckBox1 = False Then
Range(Rows(10), Rows(30)).EntireRow.Hidden = False
End If
End Sub


--
rand451
"Qaspec" wrote in message
...
I'm using the following to hide rows from a checkbox. My question is how
can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub




Alok

hiding rows with checkbox
 
Just change the following line
Selection.EntireRow.Hidden = CB1.Value
Alok Joshi


"Qaspec" wrote:

I'm using the following to hide rows from a checkbox. My question is how can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub


Qaspec

hiding rows with checkbox
 
In addition to those rows i would also like to hide/unhide row 4 on sheet2.
How do i add that into the sub?

"Norman Jones" wrote:

Hi Qaspec,

Try:

Private Sub CB1_Click()
Range("A10:A30").EntireRow.Hidden = CB1.Value
End Sub


---
Regards,
Norman



"Qaspec" wrote in message
...
I'm using the following to hide rows from a checkbox. My question is how
can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub





STEVE BELL

hiding rows with checkbox
 
Just add the sheet reference:

Sheets("Sheet2").Rows(4).EntireRow.Hidden = CB1.Value

--
rand451
"Qaspec" wrote in message
...
In addition to those rows i would also like to hide/unhide row 4 on
sheet2.
How do i add that into the sub?

"Norman Jones" wrote:

Hi Qaspec,

Try:

Private Sub CB1_Click()
Range("A10:A30").EntireRow.Hidden = CB1.Value
End Sub


---
Regards,
Norman



"Qaspec" wrote in message
...
I'm using the following to hide rows from a checkbox. My question is
how
can
i get it to unhide the rows if the checkbox is unmarked?

Private Sub CB1_Click()
For a = 10 To 30
Cells(a, 1).Select
Selection.EntireRow.Hidden = True


Next a
End Sub








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com