Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Don Selecting cells
Dear Don
Thank you for your prompt reply, unfortunately I couldn't use your code but you still might be able to help. What I am trying to do is write a macro which will delete and remove all the rows between the first two matching numbers in a column including one matching number, because all the data between matching numbers is repeat data Yours Mark |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Don Selecting cells
m,
Please keep your reply in the same thread. Sub test() Set rng = Selection For r = rng.Rows.Count To 1 Step -1 V = rng.Cells(r, 1).Value If rng.Cells(r, 1).Value = rng.Cells(r - 1, 1) Then rng.Rows(r).EntireRow.Delete End If Next r End Sub Don Pistulka "m" wrote in message ... Dear Don Thank you for your prompt reply, unfortunately I couldn't use your code but you still might be able to help. What I am trying to do is write a macro which will delete and remove all the rows between the first two matching numbers in a column including one matching number, because all the data between matching numbers is repeat data Yours Mark |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Don Selecting cells
Sorry about that. I did not know if you were still on-line.
Anyway, we Don's have to stick together. Don Pistulka "Don Guillett" wrote in message ... I guess any Don will do. -- Don Guillett SalesAid Software Granite Shoals, TX "Don P" wrote in message ... m, Please keep your reply in the same thread. Sub test() Set rng = Selection For r = rng.Rows.Count To 1 Step -1 V = rng.Cells(r, 1).Value If rng.Cells(r, 1).Value = rng.Cells(r - 1, 1) Then rng.Rows(r).EntireRow.Delete End If Next r End Sub Don Pistulka "m" wrote in message ... Dear Don Thank you for your prompt reply, unfortunately I couldn't use your code but you still might be able to help. What I am trying to do is write a macro which will delete and remove all the rows between the first two matching numbers in a column including one matching number, because all the data between matching numbers is repeat data Yours Mark |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Don Selecting cells
What would it be numbers? ____Text______
Exact examples -- Don Guillett SalesAid Software Granite Shoals, TX "m" wrote in message ... Dear Don Thank you for your prompt reply again sorry for any misunderstandings, what I need to do is delete all rows between any matchining cells in the same column e.g. 0 1 2 3 4 5 match 0delete from here 1 2 3 4 5 match to here as all data is a repeat 6 7 8 9 "Don Guillett" wrote in message ... You should have kept your answer in the same thread so it can be followed. I did not understand that to mean what you wanted. How about showing us a layout. Is it 1 1 1 2 3 3 and you want to delete the second and third rows? And the 6th row? -- Don Guillett SalesAid Software Granite Shoals, TX "m" wrote in message ... Dear Don Thank you for your prompt reply, unfortunately I couldn't use your code but you still might be able to help. What I am trying to do is write a macro which will delete and remove all the rows between the first two matching numbers in a column including one matching number, because all the data between matching numbers is repeat data Yours Mark |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Don Selecting cells
m,
Excuse me for butting in again, but appears to me from the way you describe the problem, deleting all duplicates would work: Sub test2() Set rng = Selection For r = rng.Rows.Count To 1 Step -1 dcell = rng.Cells(r, 1).Value If Application.WorksheetFunction.CountIf(rng.Columns( 1), dcell) 1 Then rng.Rows(r).EntireRow.Delete End If Next r End Sub Don Pistulka "m" wrote in message ... Dear Don Thank you for your prompt reply again sorry for any misunderstandings, what I need to do is delete all rows between any matchining cells in the same column e.g. 0 1 2 3 4 5 match 0delete from here 1 2 3 4 5 match to here as all data is a repeat 6 7 8 9 "Don Guillett" wrote in message ... You should have kept your answer in the same thread so it can be followed. I did not understand that to mean what you wanted. How about showing us a layout. Is it 1 1 1 2 3 3 and you want to delete the second and third rows? And the 6th row? -- Don Guillett SalesAid Software Granite Shoals, TX "m" wrote in message ... Dear Don Thank you for your prompt reply, unfortunately I couldn't use your code but you still might be able to help. What I am trying to do is write a macro which will delete and remove all the rows between the first two matching numbers in a column including one matching number, because all the data between matching numbers is repeat data Yours Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting Cells | Excel Worksheet Functions | |||
Selecting multiple cells, I can't see the cells highlighted | Excel Discussion (Misc queries) | |||
How to change shade of cells when selecting multiple cells | Excel Discussion (Misc queries) | |||
By selecting cells adjacent to cells tally sheet | Excel Worksheet Functions | |||
selecting cells | Excel Discussion (Misc queries) |