Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete Duplicate rows in an Excel list | Excel Discussion (Misc queries) | |||
HOW TO DELETE ALL BLANK NONADJACENT ROWS IN LARGE LIST? | Excel Worksheet Functions | |||
how can you sort a list to delete blank rows ? | Excel Discussion (Misc queries) | |||
How do I find duplicate rows in a list in Excel, and not delete it | Excel Discussion (Misc queries) | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions |