archive

Excel: Concatenate Multiple Fields

Wonna concatenate numerous fields to obtain all values in a single cell? Here’s the script:

Sub ConcatenateAll()

Dim x As String, rng As Range, cel As Range, v_new As Integer, v_old As Integer

With ActiveSheet

Set rng = .Range("F2:F2736")

For Each cel In rng

v_new = Int(cel.Value)

If (v_new <> v_old) Then
x = x & "," & Int(cel.Value)
End If

v_old = v_new

Next

.Range("G2").Value = x

End With

End Sub

And in order to insert a little bit more complicated string in ArcGIS’s Field Calculator, you need to do this:

"<img src='http://localhost/graph.php?data=36,36,37," & Int([wohnfl_per]) & "' />"

Comments are closed.