LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default < then hide

This code seems to have redundant part, but give it try.

Sub Compare2ShtsTest()
Dim shPrimary As Worksheet
Dim shSecondary As Worksheet
Dim rRangePrimary As Range
Dim rRangeSecondary As Range
Dim strPrompt As String
Dim I As Long

Set rRangePrimary = Range("G1:H536")
Set rRangeSecondary = Range("Q1:R536")
Set shPrimary = rRangePrimary.Parent
Set shSecondary = rRangeSecondary.Parent

With rRangeSecondary
For I = 1 To .Rows.Count
Select Case I
Case 1, 39, 78

Case Else
If shSecondary.Cells(I, "G") = .Cells(I, "Q") _
And shSecondary.Cells(I, "H") = .Cells(I, "R") Then
.Rows(I).Hidden = True
Else
.Rows(I).Hidden = False
End If
End Select
Next I
End With

End Sub

Keiji

Anders wrote:
Jacob and Rick

As I look at my original code - I'm not sure it's doing what I want it to.
It seems to be skipping some cells and killing some I want to see. Maybe you
have something better?

Recap - for a set range (rows 2-38, 40-77 etc (rows 1,39,78 are headers I
would like to exclude from the process if possible)) IF cells G and H match Q
and R, I want to hide them. This leaves all of the exceptions visible. If I
can leave the headers, it tells me the file reference to where the exception
is found. BTW, the data in G and Q are dates, and H and R are text.

Eternally grateful.
Anders

"Jacob Skaria" wrote:

Do you mean...

For i = 1 To .Rows.Count
If .Cells(i).Value < rRangePrimary.Cells(i).Value Then Rows(i).hidden = true
Next i

If this post helps click Yes
---------------
Jacob Skaria


"Anders" wrote:

Hi All,

I have this sub (below) working if I change the
.cells(i) to cells(i).Interior.ColorIndex = 3
but I don't want to color it red if <, I want to hide it. cells(i).hidden
= true doesn't work.

Any help is greatly appreciated!

TIA,
Anders


Sub Compare2Shts()

Dim rRangePrimary As Range
Dim rRangeSecondary As Range
Dim strPrompt As String

Set rRangePrimary = Range("g1:h536")
Set rRangeSecondary = Range("q1:r536")

With rRangeSecondary
For i = 1 To .Rows.Count
If .Cells(i).Value < rRangePrimary.Cells(i).Value Then
.Cells(i).Hidden = True
End If
Next i
End With

End Sub

 
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
How do you hide/un-hide the grid lines ED Excel Discussion (Misc queries) 4 February 26th 13 03:22 PM
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Specify which rows to NOT hide, and have excel hide the rest Mo2 Excel Programming 0 April 25th 07 03:44 AM
Hide And Un-hide Excel Toolbars Jim333[_4_] Excel Programming 3 July 2nd 05 08:00 PM
How do I hide a worksheet in Excel and use a password to un-hide . Dchung Excel Discussion (Misc queries) 3 December 2nd 04 06:24 AM


All times are GMT +1. The time now is 03:45 PM.

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"