I have a column of data with anywhere from one to 50 countries in it. I would like to test the contents and parse only the first 20 countries. If there were more than 20, I'd just like to replace the value with "more than 20 countries". Is any way other than parsing it to some other location and then copying back?
Could I somehow first count the occurences of the delimiter and if it is above some threshold then replace the value?
' Parse Country
Columns("BK:CE").Select
Selection.Insert Shift:=xlToRight
Selection.TextToColumns Destination:=Range("BJ1"), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Actual data in cell:
<table border="0" cellpadding="0" cellspacing="0" width="64"><col width="64"><tbody><tr height="17"> <td style="height: 12.75pt; width: 48pt;" height="17" width="64">United States;Switzerland;Australia;Austria;New Zealand;Philippines;Singapore;Thailand;Belgium;Luxembourg;Netherlands;Canada;China;Hong Kong;India;Malaysia;Indonesia;Japan;Korea;Pakistan;Taiwan;Vietnam;Saudi Arabi;United Arab Emirates (Abu Dhabi;Croatia;Czech Republic;Germany;Denmark;USA;United Kingdom;France;Estonia;Egypt;Swaziland;Spain;Georgia;Greece;Hungary;Ireland;Israel;Lebanon;Latvia;Lithuania;Norway;Sweden;Finland;Portugal;Russia;Slovakia;Slovenia;Turkey;Ukraine;South Africa;Argentina;Brazil;Chile;Colombia;Costa Rica;Dominican Republic;Ecuador;Guatemala;Honduras;Mexico;Nicaragua;Panama;Paraguay;Peru;Uruguay;Venezuela;El Salvador</td> </tr></tbody></table>
Could I somehow first count the occurences of the delimiter and if it is above some threshold then replace the value?
' Parse Country
Columns("BK:CE").Select
Selection.Insert Shift:=xlToRight
Selection.TextToColumns Destination:=Range("BJ1"), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Actual data in cell:
<table border="0" cellpadding="0" cellspacing="0" width="64"><col width="64"><tbody><tr height="17"> <td style="height: 12.75pt; width: 48pt;" height="17" width="64">United States;Switzerland;Australia;Austria;New Zealand;Philippines;Singapore;Thailand;Belgium;Luxembourg;Netherlands;Canada;China;Hong Kong;India;Malaysia;Indonesia;Japan;Korea;Pakistan;Taiwan;Vietnam;Saudi Arabi;United Arab Emirates (Abu Dhabi;Croatia;Czech Republic;Germany;Denmark;USA;United Kingdom;France;Estonia;Egypt;Swaziland;Spain;Georgia;Greece;Hungary;Ireland;Israel;Lebanon;Latvia;Lithuania;Norway;Sweden;Finland;Portugal;Russia;Slovakia;Slovenia;Turkey;Ukraine;South Africa;Argentina;Brazil;Chile;Colombia;Costa Rica;Dominican Republic;Ecuador;Guatemala;Honduras;Mexico;Nicaragua;Panama;Paraguay;Peru;Uruguay;Venezuela;El Salvador</td> </tr></tbody></table>