Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Conditional Hide Rows Macro

I want a macro to do a conditional hide automatically based on another
value in another cell.

For example:

If Cell A1 = "Yes" then hide rows 20:23
If Cell A1 = "No" then do not hide rows 20:23


The closest thing i can find is the below example which hides the row
based on the value (in the same row) in column T




Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Range("T" & Target.Row).Value
Case Is = "Y"
Target.EntireRow.Hidden = True
Case Is = "N"
Target.EntireRow.Hidden = False
End Select
End Sub

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


Try this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case ucase(Range("a1").Value)
case "YES"
[20:23].entirerow.hidden = true
case else
[20:23].entirerow.hidden = false
End Select
End Sub


Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548938

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Conditional Hide Rows Macro


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$1" Then Exit Sub

If UCase(Target) = "Y" Then
Rows("20:23").Hidden = True
Else
Rows("20:23").Hidden = False
End If
End Sub

another idea just assigned to a button
sub hideunhidecolg()
Columns("g").EntireColumn.Hidden = Not Columns("g").EntireColumn.Hidden
end sub
--
Don Guillett
SalesAid Software

"cchubba" wrote in message
ups.com...
I want a macro to do a conditional hide automatically based on another
value in another cell.

For example:

If Cell A1 = "Yes" then hide rows 20:23
If Cell A1 = "No" then do not hide rows 20:23


The closest thing i can find is the below example which hides the row
based on the value (in the same row) in column T




Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Range("T" & Target.Row).Value
Case Is = "Y"
Target.EntireRow.Hidden = True
Case Is = "N"
Target.EntireRow.Hidden = False
End Select
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Conditional Hide Rows Macro


colofnature wrote:
Try this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case ucase(Range("a1").Value)
case "YES"
[20:23].entirerow.hidden = true
case else
[20:23].entirerow.hidden = false
End Select
End Sub


Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548938


That works great! Thanks

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
Using VBA to Conditional Hide Rows? PBJ Excel Discussion (Misc queries) 1 February 16th 07 06:54 PM
Conditional macro to hide rows cher Excel Programming 1 April 21st 05 06:23 PM
Conditional macro to hide rows Rob Excel Programming 0 April 21st 05 05:39 PM
Conditional Hide rows with zero Vlookup help Excel Programming 2 February 4th 05 09:41 PM
Conditional hide rows macros Stu[_4_] Excel Programming 1 September 25th 03 10:05 PM


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