Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete all row data EXCEPT

I have imported data from an Outlook file that leaves me with an excel
spreadsheet with 2 columns. Data in the columns include groups that I must
keep in the following format:

In column A: I have 8 fields named
txtBusiness,txtName,txtAddress,txtCity,selState,tx tZip,txtEmail,and txtPhone

In column B, I have the actual data. However, I also have a lot of other
garbage in column A and B that I do not need and would like to delete with a
macro. I have searched the knowledge base high and low and have found
nothing that seem to fit this application. I simply need to save any row
that has the txtBusiness through txtPhone in column A and the corresponding
data in column B, and delete everything else. Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete all row data EXCEPT

Dim r as Range
Dim i as Long
for i = cells(rows.count,1).End(xlup).Row to 1 step - 1
set r = Cells(i,1)
if instr(r,"txtName") + instr(r,"txtAddress") + instr(r,"txtBusiness") _
+ instr(r,"txtCity") + instr(r,"selState") + instr(r,"txtZip") + _
instr(r,"txtPhone") = 0 then
r.EntireRow.Delete
end if
Next

--
Regards,
Tom Ogilvy


"kcoppoletta" wrote in message
...
I have imported data from an Outlook file that leaves me with an excel
spreadsheet with 2 columns. Data in the columns include groups that I must
keep in the following format:

In column A: I have 8 fields named
txtBusiness,txtName,txtAddress,txtCity,selState,tx tZip,txtEmail,and

txtPhone

In column B, I have the actual data. However, I also have a lot of other
garbage in column A and B that I do not need and would like to delete with

a
macro. I have searched the knowledge base high and low and have found
nothing that seem to fit this application. I simply need to save any row
that has the txtBusiness through txtPhone in column A and the

corresponding
data in column B, and delete everything else. Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Delete all row data EXCEPT

I would bet you could just use autofilter for values in column A which "does
not begin with" txt, and delete the rows?

"kcoppoletta" wrote in message
...
I have imported data from an Outlook file that leaves me with an excel
spreadsheet with 2 columns. Data in the columns include groups that I must
keep in the following format:

In column A: I have 8 fields named
txtBusiness,txtName,txtAddress,txtCity,selState,tx tZip,txtEmail,and
txtPhone

In column B, I have the actual data. However, I also have a lot of other
garbage in column A and B that I do not need and would like to delete with
a
macro. I have searched the knowledge base high and low and have found
nothing that seem to fit this application. I simply need to save any row
that has the txtBusiness through txtPhone in column A and the
corresponding
data in column B, and delete everything else. Thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Delete all row data EXCEPT

I missed selState, so since custom autofilter gives you up to two criteria,
they should be

"does not begin with " txt

AND

"does not equal" selState


"William Benson" wrote in message
...
I would bet you could just use autofilter for values in column A which
"does not begin with" txt, and delete the rows?

"kcoppoletta" wrote in message
...
I have imported data from an Outlook file that leaves me with an excel
spreadsheet with 2 columns. Data in the columns include groups that I
must
keep in the following format:

In column A: I have 8 fields named
txtBusiness,txtName,txtAddress,txtCity,selState,tx tZip,txtEmail,and
txtPhone

In column B, I have the actual data. However, I also have a lot of other
garbage in column A and B that I do not need and would like to delete
with a
macro. I have searched the knowledge base high and low and have found
nothing that seem to fit this application. I simply need to save any
row
that has the txtBusiness through txtPhone in column A and the
corresponding
data in column B, and delete everything else. Thanks in advance





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If data is returned then delete data LiveUser Excel Worksheet Functions 1 November 14th 07 12:22 AM
Delete data Pete Excel Discussion (Misc queries) 4 February 7th 07 01:46 PM
Delete rows with no data Mindie Setting up and Configuration of Excel 1 November 30th 05 09:24 PM
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 Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"