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
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
check the checkbox status
if cb1.value = true then
// code for hide
else
// code for unhide
endif
===== * ===== * ===== * =====
Daniel CHEN
UDQServices@Gmail.com
www.Geocities.com/UDQServices
>Free Data Processing Add-in<
===== * ===== * ===== * =====
"Qaspec" <Qaspec@discussions.microsoft.com> wrote in message
news:805D96A1-7FA5-4FB1-AE0B-0FED7429C5D9@microsoft.com...
> 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
Hi Qaspec,
Try:
Private Sub CB1_Click()
Range("A10:A30").EntireRow.Hidden = CB1.Value
End Sub
---
Regards,
Norman
"Qaspec" <Qaspec@discussions.microsoft.com> wrote in message
news:805D96A1-7FA5-4FB1-AE0B-0FED7429C5D9@microsoft.com...
> 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
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" <Qaspec@discussions.microsoft.com> wrote in message
> news:805D96A1-7FA5-4FB1-AE0B-0FED7429C5D9@microsoft.com...
> > 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
>
>
>
Just add the sheet reference:
Sheets("Sheet2").Rows(4).EntireRow.Hidden = CB1.Value
--
rand451
"Qaspec" <Qaspec@discussions.microsoft.com> wrote in message
news:39216FBB-E10C-4761-973B-48FA7847CBDE@microsoft.com...
> 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" <Qaspec@discussions.microsoft.com> wrote in message
>> news:805D96A1-7FA5-4FB1-AE0B-0FED7429C5D9@microsoft.com...
>> > 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
>>
>>
>>
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" <Qaspec@discussions.microsoft.com> wrote in message
news:805D96A1-7FA5-4FB1-AE0B-0FED7429C5D9@microsoft.com...
> 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
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks