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 do I hide rows based on spedific conditions? (VBA novice)

I would like to be able to automatically hide rows based on the value of a
particular cell in the same worksheet. I think that I should be able to do
this with a macro, but I have no experience writing my own macros, and need
thorough instructions for how to create/use a macros.

Here are some details about my excel 2003 spreadsheet: Close to the
beginning of the worksheet, there is a cell named PKG, this cell either gets
the value of "Pack of 1" or "Bulk". When PKG="Bulk", I would like rows
187-195 to be hidden, but I would like them to be displayed when PKG="Pack of
1". Could somebody please walk me through this?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default How do I hide rows based on spedific conditions? (VBA novice)

Be Glad Too...
It would look Somthing like this

Sub Marine()
If Range("PKG").Value = "Bulk" Then
Range("A187:A195").EntireRow.Hidden = True
Else
Range("A187-195").Hidden = True
End If
End Sub

"rwinter" wrote:

I would like to be able to automatically hide rows based on the value of a
particular cell in the same worksheet. I think that I should be able to do
this with a macro, but I have no experience writing my own macros, and need
thorough instructions for how to create/use a macros.

Here are some details about my excel 2003 spreadsheet: Close to the
beginning of the worksheet, there is a cell named PKG, this cell either gets
the value of "Pack of 1" or "Bulk". When PKG="Bulk", I would like rows
187-195 to be hidden, but I would like them to be displayed when PKG="Pack of
1". Could somebody please walk me through this?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default How do I hide rows based on spedific conditions? (VBA novice)

I really should read these first here is the right one

Sub Marine()
If Range("PKG").Value = "Bulk" Then
Range("A187:A195").EntireRow.Hidden = True
Else
Range("A187:A195").EntireRow.Hidden = False
End If
End Sub

Post back w/ any questions

"Office_Novice" wrote:

Be Glad Too...
It would look Somthing like this

Sub Marine()
If Range("PKG").Value = "Bulk" Then
Range("A187:A195").EntireRow.Hidden = True
Else
Range("A187-195").Hidden = True
End If
End Sub

"rwinter" wrote:

I would like to be able to automatically hide rows based on the value of a
particular cell in the same worksheet. I think that I should be able to do
this with a macro, but I have no experience writing my own macros, and need
thorough instructions for how to create/use a macros.

Here are some details about my excel 2003 spreadsheet: Close to the
beginning of the worksheet, there is a cell named PKG, this cell either gets
the value of "Pack of 1" or "Bulk". When PKG="Bulk", I would like rows
187-195 to be hidden, but I would like them to be displayed when PKG="Pack of
1". Could somebody please walk me through this?

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How do I hide rows based on spedific conditions? (VBA novice)

How does PKG get changed?

Manually or by formula?

You could use sheet event code which runs automatically off the PKG value
when it is manually changed.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("PKG")) Is Nothing Then
If Target.Value = "bulk" Then
Me.Range("A187:A195").EntireRow.Hidden = True
Else
Me.Range("A187:A195").EntireRow.Hidden = False
End If
End If
End Sub


Gord Dibben MS Excel MVP



On Wed, 10 Dec 2008 11:57:01 -0800, rwinter
wrote:

I would like to be able to automatically hide rows based on the value of a
particular cell in the same worksheet. I think that I should be able to do
this with a macro, but I have no experience writing my own macros, and need
thorough instructions for how to create/use a macros.

Here are some details about my excel 2003 spreadsheet: Close to the
beginning of the worksheet, there is a cell named PKG, this cell either gets
the value of "Pack of 1" or "Bulk". When PKG="Bulk", I would like rows
187-195 to be hidden, but I would like them to be displayed when PKG="Pack of
1". Could somebody please walk me through this?

Thanks!


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
Hide/Show rows based on Conditions manfareed Excel Programming 3 September 11th 08 04:04 PM
Code for Excel 2007 to hide rows based on sum of several rows not ina range Joe Gardill Excel Programming 2 August 29th 08 03:53 PM
hide multiple rows based on condition within rows Skymann Excel Programming 6 October 21st 07 04:01 PM
Conditional Formatting of Rows Based On More Than 4 Conditions TRenick Excel Programming 3 April 6th 05 04:25 PM
Deleting rows based upon Error conditions JEff Excel Programming 1 December 28th 04 09:55 PM


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

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"