ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HIDE ROWS IF.. (https://www.excelbanter.com/excel-programming/366032-hide-rows-if.html)

TiDz

HIDE ROWS IF..
 
how to hide rows that have values from 0 to 40 in one column depending on top
value of 3 cells? TIA

a1=2 b1=5 c1=4

result:
0
1
2
3
4
5


Norman Jones

HIDE ROWS IF..
 
Hi TiDz,

Your question is unclear.

Please try to re-explain your needs.

--
---
Regards,
Norman



"TiDz" wrote in message
...
how to hide rows that have values from 0 to 40 in one column depending on
top
value of 3 cells? TIA

a1=2 b1=5 c1=4

result:
0
1
2
3
4
5




TiDz

HIDE ROWS IF..
 
Hi Norman,
I'll try :)
I've values in one column in 41 rows from 0 to 40 and I need left of that
such quantity depending on top value of 3 cells:
if:
a1=2 b1=5 c1=4
result:
0
1
2
3
4
5
or if:
a1=3 b1=1 c1=4
result:
0
1
2
3
4


"Norman Jones" rašė:

Hi TiDz,

Your question is unclear.

Please try to re-explain your needs.

--
---
Regards,
Norman



"TiDz" wrote in message
...
how to hide rows that have values from 0 to 40 in one column depending on
top
value of 3 cells? TIA

a1=2 b1=5 c1=4

result:
0
1
2
3
4
5





TiDz

HIDE ROWS IF..
 
Hi Norman,
I'll try :)
I've values in one column in 41 rows from 0 to 40 and I need left of that
such quantity depending on top value of 3 cells:
if:
a1=2 b1=5 c1=4
result:
0
1
2
3
4
5
or if:
a1=3 b1=1 c1=4
result:
0
1
2
3
4


"Norman Jones" rašė:

Hi TiDz,

Your question is unclear.

Please try to re-explain your needs.

--
---
Regards,
Norman



"TiDz" wrote in message
...
how to hide rows that have values from 0 to 40 in one column depending on
top
value of 3 cells? TIA

a1=2 b1=5 c1=4

result:
0
1
2
3
4
5





Norman Jones

HIDE ROWS IF..
 
Hi TiDz,

Try:

'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim iMax As Long
Dim i As Long
Const col As String = "H" '<<==== CHANGE

Set WB = Workbooks("YourBook.xls") '<<==== CHANGE
Set SH = WB.Sheets("Sheet1") '<<==== CHANGE
Set rng = SH.Range("A1:C1") '<<==== CHANGE

iMax = Application.Max(rng)

SH.Columns(col).Insert

For i = 0 To iMax
SH.Cells(i + 1, col).Value = i
Next i

End Sub
'<<============



---
Regards,
Norman

"TiDz" wrote in message
...
Hi Norman,
I'll try :)
I've values in one column in 41 rows from 0 to 40 and I need left of that
such quantity depending on top value of 3 cells:
if:
a1=2 b1=5 c1=4
result:
0
1
2
3
4
5
or if:
a1=3 b1=1 c1=4
result:
0
1
2
3
4


"Norman Jones" rase:

Hi TiDz,

Your question is unclear.

Please try to re-explain your needs.

--
---
Regards,
Norman



"TiDz" wrote in message
...
how to hide rows that have values from 0 to 40 in one column depending
on
top
value of 3 cells? TIA

a1=2 b1=5 c1=4

result:
0
1
2
3
4
5







TiDz

HIDE ROWS IF..
 
Thanks, Norman
but it doesn't work for me
likely it's my blame after complicated explanation :)

it's inserting a new column, but I need to do auto "hide/unhide" of rows in
fixed range "a1:a41" (not by inserting a new column) depending by entering a
diferent values from 0 to 40 in 3 fixed cells...

any suggestion?.. :)



"Norman Jones" rašė:

Hi TiDz,

Try:

'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim iMax As Long
Dim i As Long
Const col As String = "H" '<<==== CHANGE

Set WB = Workbooks("YourBook.xls") '<<==== CHANGE
Set SH = WB.Sheets("Sheet1") '<<==== CHANGE
Set rng = SH.Range("A1:C1") '<<==== CHANGE

iMax = Application.Max(rng)

SH.Columns(col).Insert

For i = 0 To iMax
SH.Cells(i + 1, col).Value = i
Next i

End Sub
'<<============



---
Regards,
Norman

"TiDz" wrote in message
...
Hi Norman,
I'll try :)
I've values in one column in 41 rows from 0 to 40 and I need left of that
such quantity depending on top value of 3 cells:
if:
a1=2 b1=5 c1=4
result:
0
1
2
3
4
5
or if:
a1=3 b1=1 c1=4
result:
0
1
2
3
4


"Norman Jones" rase:

Hi TiDz,

Your question is unclear.

Please try to re-explain your needs.

--
---
Regards,
Norman



"TiDz" wrote in message
...
how to hide rows that have values from 0 to 40 in one column depending
on
top
value of 3 cells? TIA

a1=2 b1=5 c1=4

result:
0
1
2
3
4
5








Norman Jones

HIDE ROWS IF..
 
Hi TiDz,

If you wish, you may send me a sample workbook.In one sheet, show your
intial data; in another sheet, show the desired results.

norman_jones@NOSPAMbtconnectDOTcom

(Delete "NOSPAM" and replace "DOT" with a full stop [period] )

---
Regards,
Norman



"TiDz" wrote in message
...
Thanks, Norman
but it doesn't work for me
likely it's my blame after complicated explanation :)

it's inserting a new column, but I need to do auto "hide/unhide" of rows
in
fixed range "a1:a41" (not by inserting a new column) depending by entering
a
diferent values from 0 to 40 in 3 fixed cells...

any suggestion?.. :)




Norman Jones

HIDE ROWS IF..
 
Hi TiDz,

I received your sample workbook.

Try:

'=============
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")

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
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi TiDz,

If you wish, you may send me a sample workbook.In one sheet, show your
intial data; in another sheet, show the desired results.

norman_jones@NOSPAMbtconnectDOTcom

(Delete "NOSPAM" and replace "DOT" with a full stop [period] )

---
Regards,
Norman




TiDz

HIDE ROWS IF..
 
Thanks very much once more, Norman.
regards,
TiDz

"Norman Jones" rašė:

Hi TiDz,

I received your sample workbook.

Try:

'=============
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")

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
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi TiDz,

If you wish, you may send me a sample workbook.In one sheet, show your
intial data; in another sheet, show the desired results.

norman_jones@NOSPAMbtconnectDOTcom

(Delete "NOSPAM" and replace "DOT" with a full stop [period] )

---
Regards,
Norman






All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com