View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sheryarkhan sheryarkhan is offline
external usenet poster
 
Posts: 9
Default how can i make it better (cod to delete rows)

Hi All!
I'm new to vba.I use this code to delete rows on sheet2 if sheet1 column
"A" has the same data. Can any one help me to make it better


Option Explicit
Dim CellToCheck As Range
Dim CheckValue As String
Dim Cell As Range

Sub del()

For Each CellToCheck In Sheets("Sheet1").Range("A1:A200")
CheckValue = CellToCheck.Value & CellToCheck.Offset(0, 1).Value
For Each Cell In Sheets("Sheet2").Range("A1:A200")
If Cell.Value & Cell.Offset(0, 1).Value = CheckValue Then
Cell.EntireRow.Delete
End If
Next Cell
Next CellToCheck

End Sub

regards