3
I'm looking to automatically delete rows in Excel 2007 based on whether or not there is a cell with a specific value in that row. I've Googled around, but I've only found old information on VBA scripts for previous versions of Excel and so far all of it is non-functional. I'm looking for a SuperUser quality explanation on how to do this.
This seems ideal at first, but I'm getting a 'next without for' compile error from VB. Also, would it be possible to customize the cell requirements with a regular expression? – hisnameisjimmy – 2011-08-17T18:18:24.163
I'm running Excel2007. It's not giving me the
next without for
error when I run it. As for regex, I'm not particularly sure how to use it with VBA. With the macro above, you can, however, use conditions that the formulaCOUNTIF
supports. – Ellesa – 2011-08-17T20:40:19.5831For what it's worth, you can use wildcards in the COUNTIF as such: Application.WorksheetFunction.CountIf(Rng, "^" & "fri" & "^") Edit: okay, asterisks don't display in comments. Just imagine those carets are asterisks. – variant – 2011-08-18T17:19:02.697
Not sure why, but this macro only seemed to remove the first match and then ignore the rest :S – JDandChips – 2012-10-01T13:52:52.707