Conditional Row visible & hide for streaming worksheet

sandip_dave

New Member
Joined
Jan 2, 2017
Messages
7
I have a worksheet with streaming data of stock value, high, low, stock name in Column A3:A103, B3:B103, C3:C103, E3:E103 respectively and other columns with formulas and that updates every few seconds.


I would like to see only rows where below conditions is fulfilled and hide all other rows to filter out stocks.


Condition 1: =AND(A3=B3,A3>=L3,A3<=K3,A3<>0)
Condition 2 =AND(A3=C3,A3>=S3,A3<=R3,A3<>0)


Above condition is for example of Raw No.3 and which I am using currently for conditional formatting.


Kindly help to provide VBA codes for this.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Rich (BB code):
Rich (BB code):
For i = 3 To 103
If Not (Range("A" & i) = Range("B" & i) And Range("A" & i) >= Range("L" & i) And Range("A" & i) <= Range("K" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True
End If
If Not (Range("A" & i) = Range("C" & i) And Range("A" & i) >= Range("S" & i) And Range("A" & i) <= Range("R" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True
End If
Next i

try this
 
Upvote 0
Code:
Code:
For i = 3 To 103
If Not (Range("A" & i) = Range("B" & i) And Range("A" & i) >= Range("L" & i) And Range("A" & i) <= Range("K" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True
End If
If Not (Range("A" & i) = Range("C" & i) And Range("A" & i) >= Range("S" & i) And Range("A" & i) <= Range("R" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True
End If
Next i

try this

Thanks S_Wish, however you have not considered A3<=K3 in condition - 1 and A3<=R3 in condition - 2.

In short I need to display only rows where either of below 2 conditions are fulfilled;

Condition 1: =AND(A3=B3,A3>=L3,A3<=K3,A3<>0)
Condition 2 =AND(A3=C3,A3>=S3,A3<=R3,A3<>0)

Please update the code as per above;
Thanks
 
Upvote 0
so you need a condition like
=AND(A3=B3,A3=C3,A3>=L3,A3>=S3,A3<=R3,A3<=K3,A3<>0)
I did it, see bold
Rich (BB code):
Rich (BB code):
For i = 3 To 103
If Not (Range("A" & i) >= Range("S" & i) And Range("A" & i) <= Range("R" & i) And Range("A" & i) = Range("C" & i) And Range("A" & i) = Range("B" & i) And Range("A" & i) >= Range("L" & i) And Range("A" & i) <= Range("K" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True
End If
Next i
 
Upvote 0
Thanks S_Wish, however you have not considered A3<=K3 in condition - 1 and A3<=R3 in condition - 2.

In short I need to display only rows where either of below 2 conditions are fulfilled;

Condition 1: =AND(A3=B3,A3>=L3,A3<=K3,A3<>0)
Condition 2 =AND(A3=C3,A3>=S3,A3<=R3,A3<>0)

Please update the code as per above;
Thanks

Sorry for my mistake

you considered all.

Just need to confirm that will be it work in live streaming work sheet as data is not filled manually and it auto updates live..
 
Upvote 0
I just pasted the code in worksheet but not working.

whether i should add anything above/below provided code?
 
Upvote 0
Sub RowsHide()
For i = 3 To 103
If Not (Range("A" & i) >= Range("S" & i) And Range("A" & i) <= Range("R" & i) And Range("A" & i) = Range("C" & i) And Range("A" & i) = Range("B" & i) And Range("A" & i) >= Range("L" & i) And Range("A" & i) <= Range("K" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True
End If
Next i
End Sub
 
Upvote 0
I understood what`s problem, you do not want VBA macros, just function like =... :)
have no idea how to do it there
 
Upvote 0
I understood what`s problem, you do not want VBA macros, just function like =... :)
have no idea how to do it there

Sorry S_wish but I am very new to VBA codes.


The code is not working perfectly and hiding all the rows of data at initial run.

When I removed one of the condition as below; it worked for condition-2 but when streaming data changed and making condition-2 in other rows it does not becomes visible.



Sub RowsHide()
For i = 3 To 103


If Not (Range("A" & i) = Range("C" & i) And Range("A" & i) >= Range("S" & i) And Range("A" & i) <= Range("R" & i) And Range("A" & i) <> 0) Then
Rows(i).Hidden = True


End If
Next i
End Sub



In short,


1) code is not working with both conditions
2) It only runs once and hides all rows. It should run continuously make rows visible when either conditions be fulfilled.

Please help
 
Upvote 0

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top