Hi,
I'm looking for a way to hide and unhide the rows based on the condition in D & E.
Lets say I want to list all documents that have TR00001 in D or E, I will type TR00001 into a cell(C3).
Doing this all other rows in the defined range shall be hidden.
If I type in TR00001 into cell C3, all documents with TR00002 in D or E should only be listed(it is ok to change active sheet to make it update).
[TABLE="width: 547"]
<tbody>[TR]
[TD="align: center"]C
[/TD]
[TD="align: left"]D
[/TD]
[TD="align: right"]E
[/TD]
[/TR]
[TR]
[TD]11. CS_0461-0003----[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]12. CS_0461-0003-E-CA-000-007[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]13. CS_0461-0003-Z-SA-100-013[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]14. CS_0461-0003-V-RA-100-006[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]15.CS_0461-0003-V-RA-100-007[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]16. CS_0461-0003-V-RA-100-009[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]TR00001[/TD]
[/TR]
[TR]
[TD]17. CS_0461-0003-V-XD-100-008[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]TR00002[/TD]
[/TR]
[TR]
[TD]18. CS_0461-0003-V-RA-100-015[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]19. CS_0461-0003-Z-RA-000-008[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]
I have been struggling for a while now with this issue as I'm very new to VBA coding.
I found a similar post here which I tried to edit to work for my application;
http://www.mrexcel.com/forum/excel-...-unhiding-multiple-rows-based-cell-value.html
I tried to modify the formula as follows, but it do not seem to work perfectly.
Help and tips appreciated
Have a nice day.
Regards Hansi
I'm looking for a way to hide and unhide the rows based on the condition in D & E.
Lets say I want to list all documents that have TR00001 in D or E, I will type TR00001 into a cell(C3).
Doing this all other rows in the defined range shall be hidden.
If I type in TR00001 into cell C3, all documents with TR00002 in D or E should only be listed(it is ok to change active sheet to make it update).
[TABLE="width: 547"]
<tbody>[TR]
[TD="align: center"]C
[/TD]
[TD="align: left"]D
[/TD]
[TD="align: right"]E
[/TD]
[/TR]
[TR]
[TD]11. CS_0461-0003----[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]12. CS_0461-0003-E-CA-000-007[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]13. CS_0461-0003-Z-SA-100-013[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]14. CS_0461-0003-V-RA-100-006[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]15.CS_0461-0003-V-RA-100-007[/TD]
[TD="align: left"]TR00001[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]16. CS_0461-0003-V-RA-100-009[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]TR00001[/TD]
[/TR]
[TR]
[TD]17. CS_0461-0003-V-XD-100-008[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]TR00002[/TD]
[/TR]
[TR]
[TD]18. CS_0461-0003-V-RA-100-015[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]19. CS_0461-0003-Z-RA-000-008[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]
I have been struggling for a while now with this issue as I'm very new to VBA coding.
I found a similar post here which I tried to edit to work for my application;
http://www.mrexcel.com/forum/excel-...-unhiding-multiple-rows-based-cell-value.html
I tried to modify the formula as follows, but it do not seem to work perfectly.
Code:
Private Sub Worksheet_activate()Dim Target As Range, x As Range
Set x = Range("C3")
Sheets("TR00001").Select
For i = 11 To 19
Range("D" & i).Select
If Range("D" & i).Value = x Then
Rows(i & ":" & i).Select
Selection.EntireRow.Hidden = False
Range("D" & i).Select
Else
If Range("D" & i).Value <> x Then
Rows(i & ":" & i).Select
Selection.EntireRow.Hidden = True
Range("D" & i).Select
End If
End If
Range("E" & i).Select
If Range("E" & i).Value = x Then
Rows(i & ":" & i).Select
Selection.EntireRow.Hidden = False
Range("E" & i).Select
Else
End If
Next i
End Sub
Help and tips appreciated
Have a nice day.
Regards Hansi