Assuming that your data does not have any empty rows: Sub DeleteWhereExtra() Dim I As Integer For I = 2 To Worksheets("Sheet1").Range("A65535").End(xlUp).Row If Worksheets("Sheet1").Range("A" & I).Value = "extra" Then Worksheets("Sheet1").Range("D" & I).ClearContents End If Next I End Sub
Replace "Sheet1" with the name of your worksheet (or you can replace Worksheets("Sheet1") with the ActiveSheet object). If your data does not have a header row, change the "For I" line to read "For I = 1 to ... " and it will start at the first row. -----Original Message----- From: excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com] On Behalf Of Mehdi_21 Sent: Tuesday, February 24, 2009 10:41 AM To: MS EXCEL AND VBA MACROS Subject: $$Excel-Macros$$ problem deleting last cell in a specific row hey everyone i'm using a table like this one : A B C D 1 Main | value | value | value 2 Extra | value | value | value 3 Main | value | value | value . . n Extra | value | value | value i want to delete every cell in column "D" only when cell in column "A" contains "Extra" value. help plz regards --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---