PC Review


Reply
Thread Tools Rate Thread

I could use some help on a modification...

 
 
Knutsel
Guest
Posts: n/a
 
      14th May 2007
Hello,

I'm using a macro to hide certain rows based on clicking a checkbox.
Normaly the rows I want to hide are laying beneith each other but now
I want to hide rows who are lying separate.

The macro code I have bin using so far (for hiding group 1) is this :

--------------------------------------------------------------------------------
Private Sub CheckBox1_Click()
BeginRow = 2
EndRow = 4
ChkCol = 1
If CheckBox1.Value = True Then
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
Next RowCnt
Else
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Next RowCnt
End If
End Sub
--------------------------------------------------------------------------------
An example of the data would be something like :

groep naam
1 eik
1 den
1 beuk
2 appel
2 kers
2 aardbei
--------------------------------------------------------------------------------
In the new situation the data would be something like :

groep naam
1 eik
1 den
1 beuk
2 appel
1 kers
2 aardbei
--------------------------------------------------------------------------------

How can I change the range of rows in the macro so that it hide all
the "groep 1" rows on the click of the checkbox ?

Any help is appriciated.

Nico

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      14th May 2007

Why not just use data>filter>autofilter on the groups?
--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Knutsel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I'm using a macro to hide certain rows based on clicking a checkbox.
> Normaly the rows I want to hide are laying beneith each other but now
> I want to hide rows who are lying separate.
>
> The macro code I have bin using so far (for hiding group 1) is this :
>
> --------------------------------------------------------------------------------
> Private Sub CheckBox1_Click()
> BeginRow = 2
> EndRow = 4
> ChkCol = 1
> If CheckBox1.Value = True Then
> For RowCnt = BeginRow To EndRow
> Cells(RowCnt, ChkCol).EntireRow.Hidden = False
> Next RowCnt
> Else
> For RowCnt = BeginRow To EndRow
> Cells(RowCnt, ChkCol).EntireRow.Hidden = True
> Next RowCnt
> End If
> End Sub
> --------------------------------------------------------------------------------
> An example of the data would be something like :
>
> groep naam
> 1 eik
> 1 den
> 1 beuk
> 2 appel
> 2 kers
> 2 aardbei
> --------------------------------------------------------------------------------
> In the new situation the data would be something like :
>
> groep naam
> 1 eik
> 1 den
> 1 beuk
> 2 appel
> 1 kers
> 2 aardbei
> --------------------------------------------------------------------------------
>
> How can I change the range of rows in the macro so that it hide all
> the "groep 1" rows on the click of the checkbox ?
>
> Any help is appriciated.
>
> Nico
>


 
Reply With Quote
 
Knutsel
Guest
Posts: n/a
 
      16th May 2007
Hi Don,

Because autofilter does not work when the rows are not contigues.
Or I'm not doing it right...

Nico


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      16th May 2007
IF?? you mean that it is unsorted, it doesn't matter.
IF? you mean that there are blanks in the data>select ALL rows>then
autofilter.
Sub filterem()
With Range("A1:A" & Cells(Rows.Count, "a").End(xlUp).row)
.AutoFilter
.AutoFilter Field:=1, Criteria1:="a"
End With
End Sub
--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Knutsel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Don,
>
> Because autofilter does not work when the rows are not contigues.
> Or I'm not doing it right...
>
> Nico
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
dll modification =?Utf-8?B?bWlrZQ==?= Windows XP Internet Explorer 1 8th May 2007 11:30 PM
Table Modification: you can't open the table for modification =?Utf-8?B?c3VyeWE=?= Microsoft Access Database Table Design 1 8th Nov 2006 04:31 PM
APC 600 UPS Modification ? kathrein_help@operamail.com DIY PC 1 9th Sep 2005 08:34 PM
AVG Modification possible...? Kenneth Anti-Virus 0 16th Aug 2005 11:08 PM
i want can't modification in MDE =?Utf-8?B?RWxlY3Ryb25pYw==?= Microsoft Access Security 0 1st Oct 2004 11:23 PM


Features
 

Advertising
 

Newsgroups
 


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