#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lee lee is offline
external usenet poster
 
Posts: 184
Default Hiding Rows

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.
--
Lee
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Hiding Rows

Lee,

Right click the sheet tab, view code and paste this in and run it

Sub sonic()
Dim myrange As Range
Set myrange = Range("G5:G29")
For Each c In myrange
If IsEmpty(c) Then
c.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Lee" wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.
--
Lee

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 31
Default Hiding Rows

Have you tried using AutoFilters?

"Lee" wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.
--
Lee

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Hiding Rows

Is this a typo.......... both rows 8 & 10?

Should it be 8 & 12?

Select G5:G29 and F5SpecialBlanksOK

Hold CTRL key and Right-click on the row header of active cell and "Hide"


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 06:33:01 -0700, Lee wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lee lee is offline
external usenet poster
 
Posts: 184
Default Hiding Rows

Thanks, I entered the code as given but nothing happened. I have never
entered a code before. So what do I have to do next.
--
Lee


"Mike H" wrote:

Lee,

Right click the sheet tab, view code and paste this in and run it

Sub sonic()
Dim myrange As Range
Set myrange = Range("G5:G29")
For Each c In myrange
If IsEmpty(c) Then
c.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Lee" wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.
--
Lee



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lee lee is offline
external usenet poster
 
Posts: 184
Default Hiding Rows

Thanks for your suggestion but when I select the range and do
F5SpecialBlanksOK I get the message No cells were found.

I know how to hide individual rows by clicking at the row header. But some
times there are quite a few rows that are blank and I wanted to automate the
task.

--
Lee


"Gord Dibben" wrote:

Is this a typo.......... both rows 8 & 10?

Should it be 8 & 12?

Select G5:G29 and F5SpecialBlanksOK

Hold CTRL key and Right-click on the row header of active cell and "Hide"


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 06:33:01 -0700, Lee wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lee lee is offline
external usenet poster
 
Posts: 184
Default Hiding Rows

Yes, It was a typo. I am sorry about that.
--
Lee


"Gord Dibben" wrote:

Is this a typo.......... both rows 8 & 10?

Should it be 8 & 12?

Select G5:G29 and F5SpecialBlanksOK

Hold CTRL key and Right-click on the row header of active cell and "Hide"


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 06:33:01 -0700, Lee wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 50
Default Hiding Rows

I can't take credit for this bit of code that I collected along the way that
might do what you want. Another more experienced Excel user created it some
time ago.
------
Sub HideRows()

' Hides rows where G is blank

Dim R As Range
For Each R In Range("G5:G29")
If R.Value = "" Then Rows(R.Row).Hidden = True
Next

End Sub
------
If you copy the information between the ---- breaks, you can paste them into
the workbook by right-clicking a tab and selecting View Code. On the left
side of the window there is generally an Explorer view of the workbook
sheets. Look for a folder titled Modules. Right-click that folder and select
Insert then Module. Paste this bit of code there and then close the vb
window. This is now a Macro that is availble to run from the Macros list. It
should be titled HideRows. Just click it and choose the run button.

"Lee" wrote:

Yes, It was a typo. I am sorry about that.
--
Lee


"Gord Dibben" wrote:

Is this a typo.......... both rows 8 & 10?

Should it be 8 & 12?

Select G5:G29 and F5SpecialBlanksOK

Hold CTRL key and Right-click on the row header of active cell and "Hide"


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 06:33:01 -0700, Lee wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lee lee is offline
external usenet poster
 
Posts: 184
Default Hiding Rows

Hello Felone,

Thanks for the code and detailed instructions, but I am afraid the Code did
not work. May be reason is that the whole row is not blank.
My spreadsheet looks like this.
Employee Hours Rate Basic O/Time Other Wages

Employees names are always there. but if there are no wages for an employee
for that day or week then I want to hide the whole row for which the wages
cell is empty.
--
Lee


"Fleone" wrote:

I can't take credit for this bit of code that I collected along the way that
might do what you want. Another more experienced Excel user created it some
time ago.
------
Sub HideRows()

' Hides rows where G is blank

Dim R As Range
For Each R In Range("G5:G29")
If R.Value = "" Then Rows(R.Row).Hidden = True
Next

End Sub
------
If you copy the information between the ---- breaks, you can paste them into
the workbook by right-clicking a tab and selecting View Code. On the left
side of the window there is generally an Explorer view of the workbook
sheets. Look for a folder titled Modules. Right-click that folder and select
Insert then Module. Paste this bit of code there and then close the vb
window. This is now a Macro that is availble to run from the Macros list. It
should be titled HideRows. Just click it and choose the run button.

"Lee" wrote:

Yes, It was a typo. I am sorry about that.
--
Lee


"Gord Dibben" wrote:

Is this a typo.......... both rows 8 & 10?

Should it be 8 & 12?

Select G5:G29 and F5SpecialBlanksOK

Hold CTRL key and Right-click on the row header of active cell and "Hide"


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 06:33:01 -0700, Lee wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . Thanks.


  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 50
Default Hiding Rows

No problem Lee, just change the Range to where the blank cells would be.
Where you see ("G5:G29") can be changed to what ever column, or row you need
it to be. If the Wages column is not G, replace G with the correct column.
The code just looks in one column, if the cell in that column is blank, then
it hides the row that cell is found in. If it isn't working with the Wage
column blank, then the Wage column isn't G, or there is actually something in
the cell.

"Lee" wrote:

Hello Felone,

Thanks for the code and detailed instructions, but I am afraid the Code did
not work. May be reason is that the whole row is not blank.
My spreadsheet looks like this.
Employee Hours Rate Basic O/Time Other Wages

Employees names are always there. but if there are no wages for an employee
for that day or week then I want to hide the whole row for which the wages
cell is empty.
--
Lee


"Fleone" wrote:

I can't take credit for this bit of code that I collected along the way that
might do what you want. Another more experienced Excel user created it some
time ago.
------
Sub HideRows()

' Hides rows where G is blank

Dim R As Range
For Each R In Range("G5:G29")
If R.Value = "" Then Rows(R.Row).Hidden = True
Next

End Sub
------
If you copy the information between the ---- breaks, you can paste them into
the workbook by right-clicking a tab and selecting View Code. On the left
side of the window there is generally an Explorer view of the workbook
sheets. Look for a folder titled Modules. Right-click that folder and select
Insert then Module. Paste this bit of code there and then close the vb
window. This is now a Macro that is availble to run from the Macros list. It
should be titled HideRows. Just click it and choose the run button.

"Lee" wrote:

Yes, It was a typo. I am sorry about that.
--
Lee


"Gord Dibben" wrote:

Is this a typo.......... both rows 8 & 10?

Should it be 8 & 12?

Select G5:G29 and F5SpecialBlanksOK

Hold CTRL key and Right-click on the row header of active cell and "Hide"


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 06:33:01 -0700, Lee wrote:

I want to hide all rows in which any cell from G5:G29 is blank. Lets say if
G8 & G12 are blanks then I would like to hide both rows 8 & 10 . 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
Hiding Specific Rows Based on Values in Other Rows Chris Excel Worksheet Functions 1 November 2nd 06 08:21 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding rows not bright New Users to Excel 5 April 14th 06 10:31 PM
Hiding Rows if the linked rows are blank KG Excel Discussion (Misc queries) 9 May 18th 05 02:32 AM
Copying Rows when hiding other rows Neutron1871 Excel Worksheet Functions 2 November 3rd 04 11:38 PM


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