#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding rows

I am trying to hide rows based on a value of a sum formula. If the su
fo the row is 0, i want to hide that row. I think this should work
but it is imbedded under other for...next statements. I dont know i
this is a problem, but I get a Next without For error.

Thanks for your help in advance....


For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True

Next

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Hiding rows

Hi
there's and End if missing in your code

--
Regards
Frank Kabel
Frankfurt, Germany


I am trying to hide rows based on a value of a sum formula. If the
sum fo the row is 0, i want to hide that row. I think this should
work, but it is imbedded under other for...next statements. I dont
know if this is a problem, but I get a Next without For error.

Thanks for your help in advance....


For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True

Next a


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding rows

Thanks Frank, I caught that, but I am getting an error on the row: I
cell.Value = 0 Then

The error is: Object Required.

any ideas? Thanks again...

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding rows

Why not use the Autofilter under the data menu.

as Frank Said

For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next a

Cell is undefined, so I believe you mean activeCell

For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If Activecell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next a



--
Regards,
Tom Ogilvy

"trickdos " wrote in message
...
I am trying to hide rows based on a value of a sum formula. If the sum
fo the row is 0, i want to hide that row. I think this should work, For

a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True

Next a


but it is imbedded under other for...next statements. I dont know if
this is a problem, but I get a Next without For error.

Thanks for your help in advance....




---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding rows

See my answer.

--
Regards,
Tom Ogilvy

"trickdos " wrote in message
...
Thanks Frank, I caught that, but I am getting an error on the row: If
cell.Value = 0 Then

The error is: Object Required.

any ideas? Thanks again....


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Hiding rows

Hi Tom
i missed that one :-)

--
Regards
Frank Kabel
Frankfurt, Germany


Tom Ogilvy wrote:
Why not use the Autofilter under the data menu.

as Frank Said

For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next a

Cell is undefined, so I believe you mean activeCell

For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If Activecell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next a




"trickdos " wrote in

message
...
I am trying to hide rows based on a value of a sum formula. If the
sum fo the row is 0, i want to hide that row. I think this should
work, For a = 1 To 14 Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True

Next a


but it is imbedded under other for...next statements. I dont know

if
this is a problem, but I get a Next without For error.

Thanks for your help in advance....




---
Message posted from http://www.ExcelForum.com/


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Hiding rows

In your code, the compiler doesn't know what "cell" is.

Dim rng as Range

For a = 1 To 14
Range("hide").Value = a
Set rng = Range("hidestart").Offset(a - 1, 0)
If rng.Value = 0 Then
rng.EntireRow.Hidden = True
End If
Next a


--
George Nicholson

Remove 'Junk' from return address.


"trickdos " wrote in message
...
Thanks Frank, I caught that, but I am getting an error on the row: If
cell.Value = 0 Then

The error is: Object Required.

any ideas? Thanks again....


---
Message posted from http://www.ExcelForum.com/



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
Color alternate rows when after hiding selected rows Monk[_2_] Excel Worksheet Functions 6 June 7th 08 01:36 AM
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 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 09:53 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"