View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sinner Sinner is offline
external usenet poster
 
Posts: 142
Default Deleting rows with 11+ characters.

On Mar 31, 6:51 pm, JE McGimpsey wrote:
One way:

No need to trim that I can see.

Dim vArr As Variant
Dim rCell As Range
Dim rDelete As Range
Dim nLow As Long
Dim nHigh As Long
Dim i As Long
Dim sTest As String

With Sheets("Sheet1")
vArr = .Range(.Cells(1, 1), _
.Cells(.Rows.Count, 1).End(xlUp)).Value
End With
nLow = LBound(vArr, 1)
nHigh = UBound(vArr, 1)
With Sheets("Sheet2")
For Each rCell In .Range(.Cells(1, 1), _
.Cells(.Rows.Count, 1).End(xlUp))
sTest = rCell.Text
For i = nLow To nHigh
If sTest = vArr(i, 1) Then
If rDelete Is Nothing Then
Set rDelete = rCell
Else
Set rDelete = Union(rDelete, rCell)
End If
End If
Next i
Next rCell
If Not rDelete Is Nothing Then rDelete.EntireRow.Delete
End With

In article .com,



"Sinner" wrote:
I have the following code for deleting pins found in a list in
"column
1" of "sheet1" from list in "column 1" of "sheet 2" with the list
tagged in other columns, leaving behind updated & reconciled dataset
in sheet 2.- Hide quoted text -


- Show quoted text -


Dear I have placed your script after a button.
I need to have an error message if any of the two sheets is empty like
"List unavailable. Input list.".

Thx JE McGimpsey,