Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default hide/unhide rows depending on the top input value

Hi
I need help to edit macro below that specific range of rows could
hiding/unhiding depending on the top input value.
In this instance the results are changing dynamically when the input values
are changed:

"Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngIn As Range
Dim rngOut As Range
Dim iMax As Long


Set rngIn = Me.Range("A1:C1")
Set rngOut = Me.Range("A3:A40")

iMax = Application.Max(rngIn)

If Not Intersect(rngIn, Target) Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
Range(rngOut, rngOut.End(xlDown)).ClearContents
Set rngOut = rngOut.Resize(iMax + 1)
rngOut(1) = 0
rngOut.DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=1, Trend:=False
End If

XIT:
Application.EnableEvents = True

End Sub"

Thanx in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default hide/unhide rows depending on the top input value

Which rows get hidden? You can toggle like so

Rows("12:20").Hidden = Not Rows("12:20").Hidden

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"TiDz" wrote in message
...
Hi
I need help to edit macro below that specific range of rows could
hiding/unhiding depending on the top input value.
In this instance the results are changing dynamically when the input

values
are changed:

"Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngIn As Range
Dim rngOut As Range
Dim iMax As Long


Set rngIn = Me.Range("A1:C1")
Set rngOut = Me.Range("A3:A40")

iMax = Application.Max(rngIn)

If Not Intersect(rngIn, Target) Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
Range(rngOut, rngOut.End(xlDown)).ClearContents
Set rngOut = rngOut.Resize(iMax + 1)
rngOut(1) = 0
rngOut.DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=1, Trend:=False
End If

XIT:
Application.EnableEvents = True

End Sub"

Thanx in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default hide/unhide rows depending on the top input value

Hi Bob
Actually I need that depanding on the top value (from 1 to 40) in the
specific range stay on adequate quantity of the 40 rows in the specific range
in the sheet.


"Bob Phillips" rašė:

Which rows get hidden? You can toggle like so

Rows("12:20").Hidden = Not Rows("12:20").Hidden

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"TiDz" wrote in message
...
Hi
I need help to edit macro below that specific range of rows could
hiding/unhiding depending on the top input value.
In this instance the results are changing dynamically when the input

values
are changed:

"Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngIn As Range
Dim rngOut As Range
Dim iMax As Long


Set rngIn = Me.Range("A1:C1")
Set rngOut = Me.Range("A3:A40")

iMax = Application.Max(rngIn)

If Not Intersect(rngIn, Target) Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
Range(rngOut, rngOut.End(xlDown)).ClearContents
Set rngOut = rngOut.Resize(iMax + 1)
rngOut(1) = 0
rngOut.DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=1, Trend:=False
End If

XIT:
Application.EnableEvents = True

End Sub"

Thanx in advance!




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
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
hide and unhide rows leonidas[_4_] Excel Programming 5 June 14th 06 01:06 PM
Hide Unhide Rows blackstar Excel Discussion (Misc queries) 2 February 6th 06 09:36 PM
Hide/Unhide Rows Al Excel Programming 3 January 18th 06 07:03 PM
Hide/Unhide rows lennyx2 Excel Programming 3 May 24th 05 07:11 PM


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