LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default using a value in a cell to hide rows

I decided to take a slightly different approach and have altered the way I
was attempting to accomplish this. I decided to use a different cell, one
that frequently uses values.

The original program I explained, cell ranges to hide and all, was a
simplified version to make things easier.

Using your basic plan I have set up a working version, but still need to
make it so that if the value does not equal .76, .98, or 1.4, it will return
the spreadsheet to the final result of hiding rows 156:217. Further, if there
is an easy way to combine .98 and 1.4 (as the end result is the same), how
can that be done.

Also, with this code, if the value of the cell is .76 and I then print,
excel will also print a blank sheet in place of the rows that are hidden.

Here is the full code.

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set r = Range("B20")
If Intersect(t, r) Is Nothing Then
Exit Sub
Else: v = r.Value
If v = 0.98 Then
Rows("156:186").EntireRow.Hidden = False
Rows("187:217").EntireRow.Hidden = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$186"
End If
If v = 1.4 Then
Rows("156:186").EntireRow.Hidden = False
Rows("187:217").EntireRow.Hidden = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$186"
End If
If v = 0.76 Then
Rows("187:217").EntireRow.Hidden = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$217"
Rows("156:186").EntireRow.Hidden = True
End If
If v = "" Then
Rows("156:217").EntireRow.Hidden = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$155"
End If
End If
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
auto-hide rows, cell format (# and @), update cell refs, shade cel Mo2 Excel Discussion (Misc queries) 0 April 17th 07 03:44 AM
hide rows where cell condition is not met amaries Excel Worksheet Functions 1 January 9th 07 06:50 PM
Hide Rows if cell value is mohd21uk via OfficeKB.com New Users to Excel 1 May 16th 06 03:23 PM
hide rows when the cell is #VALUE! barkiny Excel Worksheet Functions 1 March 10th 06 03:06 PM
hide rows if cell=0 Paiolas Excel Programming 2 September 8th 03 07:14 PM


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