|
元データが A列に書いてあって、
C列に出力するものとすると、
一例ですが、以下とか?
'---------------------------------------------------- 標準モジュール
Option Explicit
Sub Try1()
Dim c As Range '元データセル
Dim r As Range '出力先セル
Dim i As Long, j As Long, k As Long
Dim ss As String, s As String
Dim v As Variant
Const z = "〜"
Set r = [C1]
For Each c In Range("A1", Cells(Rows.Count, 1).End(xlUp))
ss = c.Value
If InStr(ss, z) = 0 Then
k = k + 1
r(k, 1).Value = ss
Else
v = Split(ss, z)
s = Left$(v(0), 1)
For j = Val(Mid$(v(0), 2)) To Val(Mid$(v(1), 2))
k = k + 1
r(k, 1).Value = s & j
Next
End If
Next
End Sub
|
|