Hello,
And thank you in advance...
I have a small issue with my Filter vba code. What I am trying to do is compare one worksheet column with another worksheet column and if any of the 1st worksheet column values are not found in the 2nd worksheet column those rows in the 1st worksheet will be hidden.
Now I believe the coding works, but it is just to darn slow, and the screen flickers (Im using screenupdating.false as well) and it even goes black, not sure why? Any help would be appreciated.
***Correction: This code does not infact work, when it is ran it just hides all rows with values in them. So I am going to need some help here if anyone could spare some of their knowledge.
Thank You
My code:
<code>
Sub FilterSheet()
Dim x As Integer
x = 2
Application.ScreenUpdating = False
Do While Cells(x, 9) <> ""
If Worksheets("Sheet1").Cells(x, 9).Value = Worksheets("Sheet2").Cells(x, 6).Value Then
Else
Worksheets("Sheet1").Rows(x).Hidden = True
End If
x = x + 1
Loop
Application.ScreenUpdating = True
End Sub
<code>
Last edited by lanziniad; 12-14-2011 at 04:35 PM. Reason: Code doesn't work
Hi lanziniad,
Changing below code may help:-
Removed Else condition from above, also would appreciate if you post the sample file having this code to test further.If Worksheets("Sheet1").Cells(x, 9).Value = Worksheets("Sheet2").Cells(x, 6).Value Then Worksheets("Sheet1").Rows(x).Hidden = True End If
Regards,
DILIPandey
<click on below 'star' if this helps >
DILIPandey
+919810929744
dilipandey@gmail.com
Thanks for your reply.
I will upload a copy in just a few minutes..
Here is the sample workbook
If I remove the else statement it will hide all the rows still, I need it to only hide the rows that contain values that are not in sheet 2
Hello forum,
Just wondering if anyone had any thoughts or suggestions on this problem.
Thank you.
Hello Forum,
Not sure why that last attachment was so big, I remade the workbook and it is quite a bit smaller, sorry....
Hi lanziniad,
Attached the file back with a query plus resolution, kindly look into the same.
In the Hide (y/n) column you should get your desired results, else will be happy to explain. Thanks.
Regards,
DILIPandey
<click on below 'star' if this helps >
DILIPandey
+919810929744
dilipandey@gmail.com
Thank you for your help.....
you are welcome lanziniad.
cheers
Regards,
DILIPandey
< click on below 'star' if this helps >
DILIPandey
+919810929744
dilipandey@gmail.com
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks