Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default hiding select rows in sheets

I utilise a number of rows into which I place the steps of a chemical process.

The rows for the chemical steps are between row 20 and 87.

I enter a chemical process which takes a number of these rows to complete. I
then have to manually hide the unused rows as they are not required for
printing and for getting to other rows below row 87.

Is there a macro/code I can use which will check for empty cells in column B
(where the process is entered) in rows 20-87 so that these rows will be
automatically hidden. I already have a macro to unhide these cells.

I would need the code to work in any selected sheet as the chemical process
stages may be entered over 10 different sheets (St1, St2, St3 etc).

can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default hiding select rows in sheets

Hi,

Put this in a general module, it works on the active sheet. Note that
isempty means exactly that, a formula that returns Null isn't empty.

Sub stance()
Dim MyRange As Range
Set MyRange = ActiveSheet.Range("B20:B87")
For Each c In MyRange
If IsEmpty(c) Then
c.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Roger on Excel" wrote:

I utilise a number of rows into which I place the steps of a chemical process.

The rows for the chemical steps are between row 20 and 87.

I enter a chemical process which takes a number of these rows to complete. I
then have to manually hide the unused rows as they are not required for
printing and for getting to other rows below row 87.

Is there a macro/code I can use which will check for empty cells in column B
(where the process is entered) in rows 20-87 so that these rows will be
automatically hidden. I already have a macro to unhide these cells.

I would need the code to work in any selected sheet as the chemical process
stages may be entered over 10 different sheets (St1, St2, St3 etc).

can anyone help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default hiding select rows in sheets

Thanks Mike,

Roger

"Mike H" wrote:

Hi,

Put this in a general module, it works on the active sheet. Note that
isempty means exactly that, a formula that returns Null isn't empty.

Sub stance()
Dim MyRange As Range
Set MyRange = ActiveSheet.Range("B20:B87")
For Each c In MyRange
If IsEmpty(c) Then
c.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Roger on Excel" wrote:

I utilise a number of rows into which I place the steps of a chemical process.

The rows for the chemical steps are between row 20 and 87.

I enter a chemical process which takes a number of these rows to complete. I
then have to manually hide the unused rows as they are not required for
printing and for getting to other rows below row 87.

Is there a macro/code I can use which will check for empty cells in column B
(where the process is entered) in rows 20-87 so that these rows will be
automatically hidden. I already have a macro to unhide these cells.

I would need the code to work in any selected sheet as the chemical process
stages may be entered over 10 different sheets (St1, St2, St3 etc).

can anyone help?

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
hiding zero values on all sheets & by default on new sheets WiFiMike2006 Excel Worksheet Functions 4 January 19th 07 08:13 PM
Hiding rows containing zero in certain column on multiple sheets ell7 Excel Programming 1 August 31st 06 05:31 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding/Unhiding sheets and rows (An easy one for most of you....) Dean Goodmen Excel Programming 2 February 24th 05 11:06 PM
Hiding/Unhiding sheets and rows (An easy one for most of you....) Dean Goodmen Excel Programming 3 February 23rd 05 08:46 AM


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