Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Need to compare values in two colums and delete accordingly

In a row, if column A and column C have the same value, I need to
delete that row and then loop through to the end of the spreadsheet.

Can anyone assist?

Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need to compare values in two colums and delete accordingly

lastrow = cells(rows.count,1).end(xlup).row
for i = lastrow to 1 step -1
if cells(i,"A").Value = cells(i,"C").Value then
rows(i).Delete
end if
Next


--
Regards,
Tom Ogilvy


wrote in message
ups.com...
In a row, if column A and column C have the same value, I need to
delete that row and then loop through to the end of the spreadsheet.

Can anyone assist?

Thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Need to compare values in two colums and delete accordingly

Something like this (untested) should work. Adjust loop limits to suit.

dim i as long
with thisworkbook.sheets("sheetname")
for i = 1000 to 1 step -1

if .cells(i,1).value<"" and .cells(i,1).value = .cells(i,3).value
then
.rows(i).delete
end if

next i
end with


Tim

--
Tim Williams
Palo Alto, CA


wrote in message
ups.com...
In a row, if column A and column C have the same value, I need to
delete that row and then loop through to the end of the spreadsheet.

Can anyone assist?

Thank you



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
How can I delete all colums to the right of a specific column? ManhattanRebel Excel Discussion (Misc queries) 6 April 3rd 23 07:27 PM
Compare 2 uneven colums MDI Anne Excel Discussion (Misc queries) 2 May 12th 09 01:32 PM
Compare Sheets values in two colums Geir[_2_] Excel Worksheet Functions 1 April 7th 08 01:55 PM
How to delete unneeded colums in a sheet erwinke New Users to Excel 6 July 31st 06 11:53 AM
Need help: delete colums Hans_ Excel Programming 5 July 27th 05 04:34 PM


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

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"