CleverUserName
New Member
- Joined
- Nov 25, 2018
- Messages
- 11
I have various spreadsheets that can contain mailing addresses with anywhere from 60,000 to 140,000 records. On certain records the street address, which is represented in one cell, is listed as a range of home address numbers, such as 145-150 Smith Rd. The City, State and Zip are also in individual cells.
I need some VBA code that will look at each target record in the spreadsheet, determine if it has a range of home address numbers within it and then duplicate the record "X" amount of times but list each home number separately contained in the original range.
EXAMPLE
[TABLE="class: grid, width: 640"]
<tbody>[TR]
[TD]Ad
[TD]City[/TD]
[TD]State[/TD]
[TD]Zip[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]100-103 Columbia Ave[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123456[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]9-10 Congress St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123457[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]1 N Cutler St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123458[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]245- West St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123459[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]25A-26B North St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123460[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]-30 Center St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123461[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]RESULT[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Address[/TD]
[TD]City[/TD]
[TD]State[/TD]
[TD]Zip[/TD]
[TD][/TD]
[TD="colspan: 2"]Informational Notes Only[/TD]
[/TR]
[TR]
[TD]100-103 Columbia Ave[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123456[/TD]
[TD]
[/TD]
[TD="colspan: 2"]Original Record[/TD]
[/TR]
[TR]
[TD]100 Columbia Ave[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123456[/TD]
[TD][/TD]
[TD="colspan: 2"]Dupe Record - Split out[/TD]
[/TR]
[TR]
[TD]101 Columbia Ave[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123456[/TD]
[TD][/TD]
[TD="colspan: 2"]Dupe Record - Split out[/TD]
[/TR]
[TR]
[TD]102 Columbia Ave[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123456[/TD]
[TD][/TD]
[TD="colspan: 2"]Dupe Record - Split out[/TD]
[/TR]
[TR]
[TD]103 Columbia Ave[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123456[/TD]
[TD][/TD]
[TD="colspan: 2"]Dupe Record - Split out[/TD]
[/TR]
[TR]
[TD]9-10 Congress St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123457[/TD]
[TD]
[/TD]
[TD="colspan: 2"]Original Record[/TD]
[/TR]
[TR]
[TD]9 Congress St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123457[/TD]
[TD][/TD]
[TD="colspan: 2"]Dupe Record - Split out[/TD]
[/TR]
[TR]
[TD]10 Congress St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123457[/TD]
[TD][/TD]
[TD="colspan: 2"]Dupe Record - Split out[/TD]
[/TR]
[TR]
[TD]1 N Cutler St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123458[/TD]
[TD][/TD]
[TD="colspan: 2"]Original Record - No Range[/TD]
[/TR]
[TR]
[TD]245- West St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123459[/TD]
[TD]
[/TD]
[TD="colspan: 2"]Original Record - No Range[/TD]
[/TR]
[TR]
[TD]25A-26B North St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123460[/TD]
[TD]
[/TD]
[TD="colspan: 2"]Original Record -Not Numeric Range[/TD]
[/TR]
[TR]
[TD]-30 Center St[/TD]
[TD]ABC[/TD]
[TD]NY[/TD]
[TD="align: right"]123461[/TD]
[TD]
[/TD]
[TD="colspan: 2"]Original Record - No Range[/TD]
[/TR]
</tbody>[/TABLE]
https://drive.google.com/file/d/14If_GHcwF-xZjn8eVArFOSVHegLsxZao/view?usp=sharing