Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Delete a list of rows

I have a number of workbooks that contain multiple tabs.


I have a list of rows that are duplicated on one or more tabs. Is
there quick and dirty way for me to run a macro deleting the rows from
the list??


I.e.

My list contains the following columns
A B C D E
ref# worksheet row worksheet row


I would like to "clear" all of the references at D and E.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete a list of rows

You can loop through your list and do the deletions, however, you list would
need to be sorted by row, so you always start with the highest row on a
sheet and work down to the lowest row - otherwise, the row numbers will
change when you delete a lower row and you will start deleting the wrong
row.

so assume you are looping through column A using i

for i = numrows to 1 step -1
worksheets(cells(i,4).value).Rows(Cells(i,5).Value ) _
.EntireRow.Delete
Next

--
Regards,
Tom Ogilvy

"John Fevens" wrote in message
om...
I have a number of workbooks that contain multiple tabs.


I have a list of rows that are duplicated on one or more tabs. Is
there quick and dirty way for me to run a macro deleting the rows from
the list??


I.e.

My list contains the following columns
A B C D E
ref# worksheet row worksheet row


I would like to "clear" all of the references at D and E.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Delete a list of rows

Tom,


Thanks for you response.

A couple of questions....if I change delete to clear will that also
work? I would rather leave the row nums in tact.

Alos, when I did a trila of your code I am getting a inval or
unqualified ref.


Maybe someday I should just break down and actaully learn some VBA!



Bill



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete a list of rows

In column C and D of the active sheet I had (row 1 to 6)

Sheet2 1
Sheet1 3
Graph Data 5
Sheet2 10
Sheet2 15
Sheet1 10

Sheets were Sheet1, Sheet2, Graph Data, Sheet4. Sheet4 was active and
contained the above.

Sub BBB()
numrows = 6
For i = numrows To 1 Step -1
Worksheets(Cells(i, 4).Value).Rows(Cells(i, 5).Value) _
.EntireRow.Clear
Next

End Sub

worked fine for me. Adapt it to your situation.

--
Regards,
Tom Ogilvy


"John Fevens" wrote in message
...
Tom,


Thanks for you response.

A couple of questions....if I change delete to clear will that also
work? I would rather leave the row nums in tact.

Alos, when I did a trila of your code I am getting a inval or
unqualified ref.


Maybe someday I should just break down and actaully learn some VBA!



Bill



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Duplicate rows in an Excel list Jmh3115 Excel Discussion (Misc queries) 2 March 7th 09 06:05 AM
HOW TO DELETE ALL BLANK NONADJACENT ROWS IN LARGE LIST? sapita Excel Worksheet Functions 1 July 11th 07 10:32 PM
how can you sort a list to delete blank rows ? Irishimp23 Excel Discussion (Misc queries) 3 February 23rd 06 11:21 PM
How do I find duplicate rows in a list in Excel, and not delete it Matthew in FL Excel Discussion (Misc queries) 2 June 15th 05 09:11 PM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM


All times are GMT +1. The time now is 01:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"