#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Hide rows - VB

Hi,
Am new to Vb so bare with me..

i have a cell that contains a drop down text (Yes) or (Blank)
If that cell is (Yes), row 28 to 38 should get hidden.

can anyone figure out what am suppose to write in VB? or any other formula?
thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 185
Default Hide rows - VB

You'd need to use a Worksheet_Change event.

I've used A1 as the cell that changes. (You need to right click on the
worksheet select view code... and paste this in the window that appears and
close the window)

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Reset
With Application
.EnableEvents = False
If Not Application.Intersect(Me.Range("A1"), Target) Is Nothing Then
Select Case UCase(Target.Value)
Case Is = "YES"
Me.Rows("28:38").Hidden = True
Case Else
Me.Rows("28:38").Hidden = False
End Select
End If
.EnableEvents = True
End With
Exit Sub

Reset:
Application.EnableEvents = True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.excelusergroup.org
web: www.nickhodge.co.uk





"Batshon" wrote in message
...
Hi,
Am new to Vb so bare with me..

i have a cell that contains a drop down text (Yes) or (Blank)
If that cell is (Yes), row 28 to 38 should get hidden.

can anyone figure out what am suppose to write in VB? or any other
formula?
thanks!!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Hide rows - VB

Just as a point of interest, you can replace this part of your code...

Select Case UCase(Target.Value)
Case Is = "YES"
Me.Rows("28:38").Hidden = True
Case Else
Me.Rows("28:38").Hidden = False
End Select


with this single statement....

Me.Rows("28:38").Hidden = (UCase(Target.Value) = "YES")

Rick
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 Mawaller Excel Discussion (Misc queries) 4 August 23rd 07 04:49 PM
cut rows without cutting hide rows מיכל Excel Discussion (Misc queries) 1 June 25th 07 02:01 PM
Hide Rows shail Excel Worksheet Functions 2 September 28th 06 11:20 PM
Hide the rows shail Excel Worksheet Functions 0 September 28th 06 05:00 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 08:16 AM.

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"