example starting cell format before parse(this will make sense if you read below)"Census Tract 1, Allegany County, Maryland"
so here's what i came up with for my code. i format the column to text first so lead zeros stay, then i run parse first, (data actually is formatted with the county and state as well, and since my last post i found it would be better to save them so parse may not follow what my original posts said)
then i run leadzerounder100000 to append lead zeros to values that are under 5 digits after multiplying by 100.
martin, though the find ad replace would have worked for entries with a decimal, multiplying by 100 did the same thing, since if entries were formated "1234.1" vs "1234.01",(this time around they didn't have any like this however a different state's tracts may be different) the first would need a trail zero, since with census tracts are always 6 digits i would have to add an extra piece of code to append a trail zero, and at that point i would have forgotten which ones needed to be weeded out.
Sub multi100()
ActiveCell = ActiveCell * 100
End Sub
Sub leadzerounder100000()
If ActiveCell <= 999 Then
ActiveCell = "000" & ActiveCell
ElseIf ActiveCell <= 9999 Then
ActiveCell = "00" & ActiveCell
ElseIf ActiveCell <= 99999 Then
ActiveCell = "0" & ActiveCell
End If
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub
Sub marginerrordelete()
'
' marginerrordelete Macro
'
' Keyboard Shortcut: Ctrl+e
'
Selection.Delete Shift:=xlUp
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
End Sub
Sub stco_tract_join()
ActiveCell = ActiveCell.Offset(0, -2) & ActiveCell.Offset(0, -1)
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub
Sub parse()
'
' parse Macro
'
'
Application.DisplayAlerts = False
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 9), Array(2, 9), Array(3, 1)), TrailingMinusNumbers:=True
Application.Run "WPW_census_parse_scripts.XLSB!multi100"
ActiveCell.Offset(1, 0).Range("A1").Select
Application.DisplayAlerts = True
End Sub
this project has definitely made me think about things more modularly. when i started i had macros in too many different modules and files, but now have cleaned it up and broken down into the bare necessities. thank you for all the help. if you see any things i could make it go faster, please feel free to pitch in. my current mode of automation is to hotkey the 3 functions then hold the hotkey down until all lines are finished =P (this would suck for 10,000's of records)
Bookmarks