Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autofil on variable rows, delete extract and show remaining rows | Excel Programming | |||
Delete & Merge Columns,Delete Rows with filter, etc | Excel Programming | |||
Delete Rows if any cell in Column H is blank but do not Delete Fir | Excel Programming | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |