Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
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
Selecting Cells Terry Excel Worksheet Functions 1 August 18th 08 07:25 PM
Selecting multiple cells, I can't see the cells highlighted ET Excel Discussion (Misc queries) 1 August 1st 08 03:20 PM
How to change shade of cells when selecting multiple cells abrummet Excel Discussion (Misc queries) 3 September 6th 07 11:42 AM
By selecting cells adjacent to cells tally sheet tom Excel Worksheet Functions 2 September 20th 06 07:09 PM
selecting cells Chris Excel Discussion (Misc queries) 3 July 17th 06 09:58 PM


All times are GMT +1. The time now is 12:41 PM.

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

About Us

"It's about Microsoft Excel"