Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional hide rows macros

What I want to do is:
If data is in a certain cell then I want to unhide a row and if there
is nothing in the certain cell then I want the row to be hidden. I
understand there is no actual worksheet function to do this but you can
use a macro for this. I have no idea about macros which is my only
problem with using them. Any suggestions will be useful.

Thank you



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Conditional hide rows macros

Stu

Here's a primer on using VBA in Excel

http://www.mvps.org/dmcritchie/excel/getstarted.htm

For you particular problem, you need to identify the Range object that is
that cell and test its Value property. Based on that test, you would use
the EntireRow property to return a Range object that encompasses the entire
row and use the Hidden property to hide or unhide it. Here's a basic
example

If Range("A1").Value = 3 Then
Range("A1").EntireRow.Hidden = True
Else
Range("A1").EntireRow.Hidden = False
End If

If you want to check a number of cells, you can use a For Each construct to
loop through all the cells in a particular range. Here's an example of that

Dim Cell as Range

For Each Cell in Range("C1:C10").Cells
If Cell.Value = 3 Then
Cell.EntireRow.Hidden = True
Else
Cell.EntireRow.Hidden = False
End If
Next Cell

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Stu" wrote in message
...
What I want to do is:
If data is in a certain cell then I want to unhide a row and if there
is nothing in the certain cell then I want the row to be hidden. I
understand there is no actual worksheet function to do this but you can
use a macro for this. I have no idea about macros which is my only
problem with using them. Any suggestions will be useful.

Thank you



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly 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
Hide rows with conditional formatting Gerry Verschuuren Excel Discussion (Misc queries) 5 April 8th 07 01:34 PM
Easy way to Hide & Show Rows and update associated macros Eggtavius Excel Discussion (Misc queries) 0 March 28th 07 03:05 AM
Easy way to Hide & Show Rows and update associated macros Farhad Excel Discussion (Misc queries) 0 March 28th 07 01:21 AM
Using VBA to Conditional Hide Rows? PBJ Excel Discussion (Misc queries) 1 February 16th 07 06:54 PM
Conditional Hide/Unhide Rows Gwen H Excel Discussion (Misc queries) 4 March 30th 05 06:52 AM


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