Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Deleting rows with same address

I have a spreadsheet with 6 columns; 1-name (last name, first name),
2-address1, 3-address2 4-city, 5-state and 6-zip code. The spreadsheet shows
members of my organization. I am trying to stop sending two mailings to the
same address to save postage.

I need help in creating a formula or a macro to:

1. Sort by zip code, state, city, address1 and address2
2. Check to see if address is the same as one above.
3. If so, check to see if last name is the same as one above
4. If 3 & 4 are yes, take the first name of the second row and add it to
the first name of the first row, insert an ampersand (&) [e.g. Jane & Joe Doe)
5. Delete the second row

Any and all help will be appreciated!
--
NOEL@HOME
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Deleting rows with same address

Sent this

Sub combinenames()
mc = 2 'col B

lr = Cells(Rows.Count, mc).End(xlUp).Row
For i = lr To 2 Step -1

If Cells(i - 1, mc) = Cells(i, mc) Then
p1 = InStr(Cells(i - 1, mc - 1), ",") - 1

If Left(Cells(i - 1, mc - 1), p1) = Left(Cells(i, mc - 1), p1) Then
Cells(i - 1, mc - 1).Value = Cells(i - 1, mc - 1) _
& " &" & Right(Cells(i, mc - 1), Len(Cells(i, mc - 1)) - p1 - 1)
Rows(i).Delete
End If

End If
Next i
Columns(1).Columns.AutoFit

'sort
Range("A1:G" & lr).Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...

Fairly simple. Easier if you just send your wb to my address below instead
of me re-creating it.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"noel" wrote in message
...
I have a spreadsheet with 6 columns; 1-name (last name, first name),
2-address1, 3-address2 4-city, 5-state and 6-zip code. The spreadsheet
shows
members of my organization. I am trying to stop sending two mailings to
the
same address to save postage.

I need help in creating a formula or a macro to:

1. Sort by zip code, state, city, address1 and address2
2. Check to see if address is the same as one above.
3. If so, check to see if last name is the same as one above
4. If 3 & 4 are yes, take the first name of the second row and add it to
the first name of the first row, insert an ampersand (&) [e.g. Jane & Joe
Doe)
5. Delete the second row

Any and all help will be appreciated!
--
NOEL@HOME



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
Deleting large gaps in address gloria81101 Excel Discussion (Misc queries) 1 August 1st 07 08:50 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM
How do I move up rows below blank rows in an address? goggem Excel Worksheet Functions 0 May 17th 05 04:01 AM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM


All times are GMT +1. The time now is 01:15 AM.

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

About Us

"It's about Microsoft Excel"