View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Selecting data with a specfic value only

Give this macro a try (change the SearchName constant to the name you want
to keep)...

Sub DumpData()
Dim X As Long
Dim LastRow As Long
Const SearchName As String = "Bob"
On Error GoTo Whoops
Application.ScreenUpdating = False
With Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "AG").End(xlUp).Row
For X = LastRow To 1 Step -1
If StrComp(.Cells(X, "AG").Value, SearchName, vbTextCompare) < 0 Then
.Rows(X).Delete
End If
Next
End With
Whoops:
Application.ScreenUpdating = True
End Sub

--
Rick (MVP - Excel)


"ATanker62" wrote in message
...
Hello all,
Excel 2007
I obtain a dump of data into an Excel spreadsheet. I cannot change the
requested data from the data dump, it simply gives me all the transactions
for every client. I wish to extract from this dump of data only the
information for one specfic client. I would like to write a macro to do
this. The client name appears in the column AG also called sitename. Any
ideas, thanks