![]() |
Selecting data with a specfic value only
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 |
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 |
Selecting data with a specfic value only
Since this code deletes the rows that don't match, I recommend making a copy
of the worksheet before running this. |
Selecting data with a specfic value only
Excellent suggestion! Thanks for posting it.
-- Rick (MVP - Excel) "Phillip M. Feldman" wrote in message ... Since this code deletes the rows that don't match, I recommend making a copy of the worksheet before running this. |
Selecting data with a specfic value only
Thank you it works great
"Rick Rothstein" wrote: 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 |
All times are GMT +1. The time now is 01:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com