LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Trouble with Hiding Rows


Good Morning!

I have been stumped on this problem for awhile and no matter what I use
- SOMETHING goes wrong.

What I am doing is creating an invoice (for various users) to fill out.
There are 9 different sections. One section has five subsections,
another has four subsections, six sections have one subsection, and the
last section does not have a subsection.

Once the client receives the invoice from a user - they will open two
additional sheets - each that looks like the invoice (but not exactly
since each sheet performs a breakdown of cost and differences).

The purpose of this particular VBA is to hide all the unused rows
(and/or affiliated rows) when the user has completed filling out the
invoice form. I have tried different codings - but again - SOMETHING
keeps going wrong.

The lastest coding that I have is for the first section (with
subsections):

Range (Cells) Z = Total of the line (which is Qty.*Rate)

'First subsection
If Range("Z25").Value = 0 Then Rows("25:26").Hidden = True
If Range("Z27").Value = 0 Then Rows("27:28").Hidden = True
If Range("Z29").Value = 0 Then Rows("29:30").Hidden = True
If Range("Z31").Value = 0 Then Rows("31:32").Hidden = True
If Rows("25:32").Hidden = True Then Rows("24").Hidden =
True 'takes out header

'Second subsection
If Range("Z35").Value = 0 Then Rows("35:36").Hidden = True
If Range("Z37").Value = 0 Then Rows("37:38").Hidden = True
If Range("Z39").Value = 0 Then Rows("39:40").Hidden = True
If Range("Z41").Value = 0 Then Rows("41:42").Hidden = True
If Rows("35:42").Hidden = True Then Rows("33:34").Hidden = True
'takes out header and line above

'Third subsection
If Range("Z45").Value = 0 Then Rows("45:46").Hidden = True
If Range("Z47").Value = 0 Then Rows("47:48").Hidden = True
If Range("Z49").Value = 0 Then Rows("49:50").Hidden = True
If Range("Z51").Value = 0 Then Rows("51:52").Hidden = True
If Rows("45:52").Hidden = True Then Rows("43:44").Hidden =
True ' takes out header & line above

'Fourth subsection
If Range("Z55").Value = 0 Then Rows("55:56").Hidden = True
If Range("Z57").Value = 0 Then Rows("57:58").Hidden = True
If Range("Z59").Value = 0 Then Rows("59:60").Hidden = True
If Range("Z61").Value = 0 Then Rows("61:62").Hidden = True
If Range("Z63").Value = 0 Then Rows("63:64").Hidden = True
If Range("Z65").Value = 0 Then Rows("65:66").Hidden = True
If Range("Z67").Value = 0 Then Rows("67:68").Hidden = True
If Range("Z69").Value = 0 Then Rows("69:70").Hidden = True
If Range("Z71").Value = 0 Then Rows("71:72").Hidden = True
If Range("Z73").Value = 0 Then Rows("73:74").Hidden = True
If Range("Z75").Value = 0 Then Rows("75:76").Hidden = True
If Range("Z77").Value = 0 Then Rows("77:78").Hidden = True
If Range("Z79").Value = 0 Then Rows("79:80").Hidden = True
If Range("Z81").Value = 0 Then Rows("81:82").Hidden = True
If Range("Z83").Value = 0 Then Rows("83:84").Hidden = True
If Range("Z85").Value = 0 Then Rows("85:86").Hidden = True
If Range("Z87").Value = 0 Then Rows("87:88").Hidden = True
If Range("Z89").Value = 0 Then Rows("89:90").Hidden = True
If Rows("55:90").Hidden = True Then Rows("53:54").Hidden = True
' takes out header & line above

'Fifth subsection
If Range("Z93").Value = 0 Then Rows("93:94").Hidden = True
If Range("Z95").Value = 0 Then Rows("95:96").Hidden = True
If Range("Z97").Value = 0 Then Rows("97:98").Hidden = True
If Range("Z99").Value = 0 Then Rows("99:100").Hidden = True
If Range("Z101").Value = 0 Then Rows("101:102").Hidden = True
If Range("Z103").Value = 0 Then Rows("103:104").Hidden = True
If Range("Z105").Value = 0 Then Rows("105:106").Hidden = True
If Rows("93:106").Hidden = True Then Rows("91:92").Hidden =
True ' takes out header & line above

If Rows("24:106").Hidden = True Then
Rows("22:113").Hidden = True 'for the whole section


The end result of this is that it hides the whole section - regardless
if there are amounts or not UNLESS the very first row - Range("Z25")
has a value 0.

This is happening in all the sections.

What am I doing wrong?

Your help is VERY much appreciated!

TIA,
Sarr


--
Sarrina
------------------------------------------------------------------------
Sarrina's Profile: http://www.excelforum.com/member.php...o&userid=22337
View this thread: http://www.excelforum.com/showthread...hreadid=379002

 
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
Trouble hiding commandbars Andy Excel Programming 2 October 19th 04 04:17 PM


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