ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Don Selecting cells (https://www.excelbanter.com/excel-programming/271489-don-selecting-cells.html)

m[_3_]

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



Don P

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





Don P

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









Don Guillett[_4_]

Don Selecting cells
 
Don. No need to be sorry. I didn't mind at all.

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"Don P" wrote in message
...
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











Don Guillett[_4_]

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









Don P

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










All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com