AgTalk Home
AgTalk Home
Search Forums | Classifieds (127) | Skins | Language
You are logged in as a guest. ( logon | register )

Excel 2007 question
View previous thread :: View next thread
   Forums List -> Computer TalkMessage format
 
Omar
Posted 12/18/2014 18:26 (#4249478 - in reply to #4248971)
Subject: RE: Excel 2007 question


Elmira, Ontario

Judging by the number of rows, you don't want to do the manual method.

Here's some macro code, but it will only clear one row at a time so you need to run it once for each row affected. You can set up a macro button to make that happen more easily.

Note, I forced this to only look in column A so you don't accidentally clear data from other areas of the sheet. Also, I set it to clear the row. If you really meant to delete the row, just change the word "clear" to "delete".

Sub RemoveTotalRows()
   
   
    Columns("A:A").Select
   
    On Error Resume Next
    Selection.Find(What:="Total", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).EntireRow.Clear
   
    Range("a1").Select
   
End Sub

Edit: put the word Total in A1 (insert a row if you need to so this is the only thing on that row). You'll note that will be the last row that will be cleared. Once it is gone, then you know the macro has cleared everything.



Edited by Omar 12/18/2014 18:28
Top of the page Bottom of the page


Jump to forum :
Search this forum
Printer friendly version
E-mail a link to this thread

(Delete cookies)