Hi,
Please help me this scenario:
I would like to have a macro that will delete all the rows in a worksheet that contains the word "total". Please help.
Thank you.
Hi,
Please help me this scenario:
I would like to have a macro that will delete all the rows in a worksheet that contains the word "total". Please help.
Thank you.
You can do this with a simple find in VB. First you will need to be sure that the word "Total" doesn't appear in any row that you do not want to delete. Then you need code that is something like:
Replace SheetName with the name of your worksheet.Please Login or Register to view this content.
This deletes rows that have the word Total (not case sensitive) anywhere in any cell, including in the formulas.
To look at final values only and ignore formulas (ie look at the answers in the cells, not the string in the formula bar), change "xlFormulas" to "xlValues".
To only look at cells that contain nothing but the word "total", change "xlPart" to "xlWhole".
To make the search case sensitive, change "MatchCase:=False" to "MatchCase:=True".
Last edited by Kafrin; 06-22-2009 at 10:38 AM.
thank you for responding. Where do i put this code and how would i run it? Pleas help. Thanks.
My approach would be to put the code in a general module then create a command button (form control) in the worksheet. Assign the posted macro to the command button. Click the button and the macro fires.
Hope this helps.
J
thanks for the idea. But the reason I would like it have as a macro so just I can press the shortcut key anytime I want and the code will run. Please help.
Thank you.
Here are a couple of links regarding assigning a macro to the keyboard.
http://excel.tips.net/Pages/T002714_...mbination.html
http://office.microsoft.com/en-us/ex...023061033.aspx
Hope this helps.
J
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks