#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Hide Rows

Hi,

I have a dropdown validation list. When I select an item from this
list, the rows below will be populated using the HLOOKUP function. The
HLOOKUP function brings the values from the other sheet. The records
will be one to one thousand. And I have the formula upto 1000 rows.
When item has just one value in it the other rows will have the value
zero.

I need to hide those rows which have the zero values. I could have use
the Autofilter, but I need it when the item is selected from the
dropdown list. So this could be done using VBA code.

Please help



Shail

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Hide Rows

Assume the dropdown is in B10 of the sheet.
Right click on the sheet tab and select view code. Put in code like this:

Change B11:B1010 to the range where you want to check for zero values.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell as Range
if Target.count 1 then exit sub
If Target.Address(0,0) = "B10" then
range("B11:B1010").EntireRow.Hidden = False
for each cell in range("B11:B1010")
if cell.Value = 0 then
cell.EntireRow.Hidden = True
end if
Next
End Sub
--
Regards,
Tom Ogilvy


"Shail" wrote:

Hi,

I have a dropdown validation list. When I select an item from this
list, the rows below will be populated using the HLOOKUP function. The
HLOOKUP function brings the values from the other sheet. The records
will be one to one thousand. And I have the formula upto 1000 rows.
When item has just one value in it the other rows will have the value
zero.

I need to hide those rows which have the zero values. I could have use
the Autofilter, but I need it when the item is selected from the
dropdown list. So this could be done using VBA code.

Please help



Shail


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
Group rows (or hide rows) like in MS Project Annie1904 Excel Worksheet Functions 2 October 17th 09 05:15 AM
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
cut rows without cutting hide rows מיכל Excel Discussion (Misc queries) 1 June 25th 07 02:01 PM
Hide Rows - copy and paste only rows that show Access101 Excel Worksheet Functions 3 March 1st 06 12:39 AM


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