Hi,
Im trying to do a macro that would look at column D and if date is less than 01/01/2012 to delete the whole row.
Thank you
Hi,
Im trying to do a macro that would look at column D and if date is less than 01/01/2012 to delete the whole row.
Thank you
Hello,
Below is a code that will do what you need. Anything in green is a comment. If you are unfamiliar with macros, you place this code by pressing alt F11 and then selecting Insert from the top in Visual Basic. Select the Module option and copy the code below into the window.
![]()
Please Login or Register to view this content.
Searches column A for values earlier than 1/1/2012. (My excel converts 01/01/2012 to 1/1/2012 so hopefully not an issue for you either.)![]()
Please Login or Register to view this content.
Rvasquez
I'm working with 70,000 rows and this macro was running for 10 min and I had to stop it.
111stepsahed
I adjusted the range but it doesn't delete all the rows with date less than 1/1/2012
How about something like:
![]()
Please Login or Register to view this content.
StevenM reminded me that you can't loop forwards when deleting rows. You have to start from the bottom and go to the top. Code should be fixed now but probably won't run faster than Rvasquez's code did.![]()
Please Login or Register to view this content.
111StepsAhead,
Here's a quicker way to do it. The below macro filters the data to only show dates less than 01/01/2011 and then deletes all filtered rows.
Let me know if it works for you!![]()
Please Login or Register to view this content.
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks