Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default I could use some help on a modification...

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default I could use some help on a modification...


Why not just use datafilterautofilter on the groups?
--
Don Guillett
SalesAid Software

"Knutsel" wrote in message
oups.com...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default I could use some help on a modification...

IF?? you mean that it is unsorted, it doesn't matter.
IF? you mean that there are blanks in the dataselect ALL rowsthen
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

"Knutsel" wrote in message
oups.com...
Hi Don,

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

Nico



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
Formula modification yshridhar Excel Worksheet Functions 10 November 23rd 07 08:16 AM
last modification Chip Smith Excel Discussion (Misc queries) 1 June 19th 06 11:55 PM
Modification Steved[_3_] Excel Programming 2 September 8th 04 08:09 PM
Macro Modification Help MM[_4_] Excel Programming 1 July 29th 04 10:37 PM
Modification to code Peter Atherton Excel Programming 1 September 23rd 03 07:36 PM


All times are GMT +1. The time now is 10:21 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"