Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Finding the last one

I have colums and rows of data. The data is grouped in four rows down
two columns across. I sometime have repeating data. I am trying ot
figure out a way so that it looks through the colum find the first and
the last then deletes all but the last.

Ex.

Layer1
Layer2
Layer3
Layer4
Layer5 <----delete this one
Layer5 <----delete this one
Layer5 <----delete this one
Layer5 <--- keep this one

It's always the last part of the data. Layer five is the highest it
will go if that help. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Finding the last one

This is very easy. Too easy

RowCount = 1
do while cells(RowCount,"A").value < ""
if cells(RowCount,"A").value = _
cells(RowCount + 1,"A").value then

Rows(RowCount).delete
else
RowCount = RowCount + 1
end if
loop


" wrote:

I have colums and rows of data. The data is grouped in four rows down
two columns across. I sometime have repeating data. I am trying ot
figure out a way so that it looks through the colum find the first and
the last then deletes all but the last.

Ex.

Layer1
Layer2
Layer3
Layer4
Layer5 <----delete this one
Layer5 <----delete this one
Layer5 <----delete this one
Layer5 <--- keep this one

It's always the last part of the data. Layer five is the highest it
will go if that help. Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Finding the last one

How would I do it for the case that I have to look at every 4th row,
not every row.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Finding the last one

Instead of my original code change the count increment from 1 to 4
from
RowCount = 1
do while cells(RowCount,"A").value < ""
if cells(RowCount,"A").value = _
cells(RowCount + 1,"A").value then

Rows(RowCount).delete
else
RowCount = RowCount + 1
end if
loop

to:
RowCount = 1
match = False
do while cells(RowCount,"A").value < ""
if cells(RowCount,"A").value = _
cells(RowCount + 1,"A").value then

Rows(RowCount).delete
MAtch = true
else
if Match = true then
RowCount = RowCount + 1
Mtch = False
else
RowCount = RowCount + 4
end if
loop



" wrote:

How would I do it for the case that I have to look at every 4th row,
not every row.





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
Finding the first value that is less than zero russhess8 Excel Worksheet Functions 4 June 25th 09 03:19 AM
Finding a Value SueK Excel Discussion (Misc queries) 3 September 21st 08 07:27 PM
Finding second value? bgkgmg Excel Worksheet Functions 6 August 24th 08 05:22 PM
Finding the top 10 Bertha needs help[_2_] Excel Discussion (Misc queries) 13 August 5th 08 04:41 PM
finding value ceemo Excel Discussion (Misc queries) 4 April 20th 06 02:16 PM


All times are GMT +1. The time now is 01:43 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"