Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to hide rows

I have a worksheet contains 10,000 rows and columns A to H
The range is A1:H10,000.

e.g.
colums: A B C D E F G H

1) M N O P Q R S T

2) O P Q R S A B C

3) A B P Q R C D E

4) A B D G H I J K

In the above example, row 1 will be hidden, row 2 will also be hidden,
row 3 will not be hidden.
This module will check present row against next row , if it find 5 or
more cells are equal , then
the present row will be hidden and this will loop through the whole
worksheet.

Thank you for the help.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to hide rows

Michael:

This code should do it..

Sub CompareCells()
Dim c, c1, r, iCounter As Integer
r = 1
iCounter = 0

Do Until Cells(r, 1) = ""

For c1 = 1 To 8
For c = 1 To 8
If Cells(r, c1) = Cells(r + 1, c) Then
iCounter = iCounter + 1
End If
Next c
Next c1

If iCounter = 5 Then
Rows(r).Select
Selection.EntireRow.Hidden = True
End If
r = r + 1
iCounter = 0
Loop

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to hide rows

Michael,

You can use the code below or download the file named 'Michael168.xls'
below.

Sub CompareCells()
Dim c, c1, r, iCounter As Integer
r = 1
iCounter = 0

Do Until Cells(r, 1) = ""

For c1 = 1 To 8
For c = 1 To 8
If Cells(r, c1) = Cells(r + 1, c) Then
iCounter = iCounter + 1
End If
Next c
Next c1

If iCounter = 5 Then
Rows(r).Select
Selection.EntireRow.Hidden = True
End If

r = r + 1
iCounter = 0

Loop

End Sub

File Attached: http://www.exceltip.com/forum/attach...?postid=287736 (michael168.xls)

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

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
Group rows (or hide rows) like in MS Project Annie1904 Excel Worksheet Functions 2 October 17th 09 05:15 AM
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
cut rows without cutting hide rows מיכל Excel Discussion (Misc queries) 1 June 25th 07 02:01 PM
Hide Rows - copy and paste only rows that show Access101 Excel Worksheet Functions 3 March 1st 06 12:39 AM


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

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

About Us

"It's about Microsoft Excel"