S
sheryarkhan
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
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