How's your VBA?!
Put this code in the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, stInput() As String, stOutput() As String
Dim stRangeName As String, iRangeIndex As Integer
Dim i As Integer, j As Integer
On Error GoTo ErrCatch
Application.EnableEvents = False
For Each c In Target
If c.Value = "" Or c.Column = 1 Then Exit Sub
stInput() = Split(c.Value, ";")
ReDim stOutput(UBound(stInput))
For i = LBound(stInput) To UBound(stInput)
stRangeName = Left(stInput(i), FirstNumber(stInput(i)))
iRangeIndex = CInt(Right(stInput(i), Len(stInput(i)) - FirstNumber(stInput(i))))
stOutput(i) = Range(stRangeName).Cells(iRangeIndex).Value
Next i
c.Value = Join(stOutput, "")
Next c
Application.EnableEvents = True
Exit Sub
ErrCatch:
Debug.Print "Error: " & Err.Number & " - " & Err.Description
Application.EnableEvents = True
End Sub
Function FirstNumber(ByVal s As String)
Dim i As Integer
For i = 1 To Len(s)
If IsNumeric(Mid(s, i, 1)) Then
FirstNumber = i - 1
Exit Function
End If
Next i
End Function
Now, just type in the range names / indexes you want, in a cell. No = sign first. For example, enter:
Formula:
PLACES3;MUSIC5;FRUIT2;ALC8;SOFT7
and it will automatically change to:
Formula:
BAR3;JAZ5;APPLE2;VODKA8;TONIC7;
Bookmarks