私はランチにわたって非作業関連のコードを書くことが好き:
Sub NamesToList()
'Assumes that a cell is selected which contains a string which
'looks something like "Name1;Name2;Name3"
'The sub splits that list and then puts the values immediately
'below the selected cell. Warning: this doesn't check if there is
'room for those values and will overwrite existing values with no
'warning
Dim A As Variant, n As Long, R As Range
Set R = Selection
A = Split(R.Value, ";")
n = UBound(A)
Range(R.Offset(1), R.Offset(n + 1)).Value = Application.WorksheetFunction.Transpose(A)
End Sub
A1
が選択されているときにこのサブを起動した場合、名前はなりますA2:A4
に自動的に挿入されます。エラーチェックは行われないので、おそらくこのコードを調整して、そうでないことを確認してください。任意の値を上書きします。
Split( "Name1; Name2; Name3"、 ";") 'は3要素の配列を返します。その配列の値をワークシートに入れることができます。何を試しましたか? –
なぜ* VBA *であるかは、ワークシート関数で行うことができます。 –