Hi
In range A1:A300 I have a lotof words. What I want is to delete entire row if the cell value is Open date
My code is
But doesnt workind. It just loops...Please Login or Register to view this content.
Hi
In range A1:A300 I have a lotof words. What I want is to delete entire row if the cell value is Open date
My code is
But doesnt workind. It just loops...Please Login or Register to view this content.
Last edited by teylyn; 12-12-2009 at 05:19 AM.
Люди, питающие благие намерения, как раз и становятся чудовищами.
Regards, ?Born in USSR?
Vusal M Dadashev
Baku, Azerbaijan
CWE, you should (to avoid sledgehammer) use Auto Filter or even use Find loop or temp formulae column and specialcells...
However, all that being said, to demonstrate the Loop syntax given this is the what you're trying to get to grips with (I think):
Points worth noting in the abovePlease Login or Register to view this content.
1 - always work bottom to top when deleting anything
2 - avoid .Select as this is rarely warranted and slows your code
3 - note VBA by default is case sensitive (the opposite of native XL) so if you wish to conduct case insensitive comparisons you should ensure case sensitivity is removed either by:
a) ensuring all values are in common case (as above via UCase)
b) using Option Compare Text at head of Module
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
GREAT THANX !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
but one more question. When I work bottom to top, do I have to always use step -1, or what will happen if I dont do this?
Thanks again...
Yes. The best thing to do is work through logically what's happening...
If you iterate 1 to 10 (top -> bottom) and delete say row 5 then when you iterate to 6 you're really jumping to the original row 7 given what was row 6 is now row 5 (original row 5 removed).
This is why we say iterate 10 to 1 ... when you do this when you get to row 5 and delete it the step -1 moves you from 5 to 4 ... row 4 is unaffected by the removal of row 5 ... as we know from before it is only the rows below the old row 5 (6 to 10) that will have been affected and that will have shifted upwards (ie now 5-9)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks