[[excelの便利マクロ]] * 文字列を指定幅で分割する [#cea395d3] Sub SplitString() c = ActiveCell.Column r = ActiveCell.Row Dim formatdesc() As Variant ReDim formatdesc(199) Cells(r + 1, c).Select Range(Selection, Selection.End(xlToRight)).Select s = 0 i = 0 For Each v In Selection formatdesc(i) = Array(s, xlTextFormat) s = s + v.Value * 2 i = i + 1 Next v ReDim Preserve formatdesc(i - 1) Cells(r, c).Select Selection.TextToColumns Destination:=Range(Cells(r, c), Cells(r, c)), DataType:=xlFixedWidth, _ FieldInfo:=formatdesc, _ TrailingMinusNumbers:=True End Sub #img(201501-splitstring.png) #ref(201501-splitstring.png)