Показать сообщение отдельно

  #8  
Старый 24.03.2009, 05:44
Pashkela
Динозавр
Регистрация: 10.01.2008
Сообщений: 2,841
С нами: 9649706

Репутация: 3338


По умолчанию

Ну вот и для целой колонки (данные вставляй в "A" колонку):

Код:
kol = 3 ' Кол-во данных в колонке, которые надо разлепить
    ColumnIndex = 11
    ColumnIndex1 = 2
    For j = 1 To kol Step 1
    Range("B" & j & "").Select
    ActiveCell.FormulaR1C1 = "=LEN(RC[-1])"
    len1 = Sheets(1).Cells(j, ColumnIndex1).Value
    For i = 2 To len1 Step 1
    sh = i - 1
    Range("C" & j & "").Select
    ActiveCell.FormulaR1C1 = "=LEFT(RC[-2]," & i & ")"
    Range("D" & j & "").Select
    ActiveCell.FormulaR1C1 = "=CODE(RC[-1])"
    Range("E" & j & "").Select
    ActiveCell.FormulaR1C1 = "=RIGHT(RC[-2],1)"
    Range("F" & j & "").Select
    ActiveCell.FormulaR1C1 = "=CODE(RC[-1])"
    Selection.Copy
    Range("K" & j & "").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Application.CutCopyMode = False
    If (Sheets(1).Cells(j, ColumnIndex).Value < 224) Then
       Range("G" & j & "").Select
       ActiveCell.FormulaR1C1 = "=LEFT(RC[-6]," & sh & ")"
       Range("H" & j & "").Select
       sh = len1 - i + 1
       ActiveCell.FormulaR1C1 = "=RIGHT(RC[-7]," & sh & ")"
       Range("I" & j & "").Select
       ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-2],"" "",RC[-1])"
       Columns("I:I").EntireColumn.AutoFit
       i = len1
    End If
    Next i
    Next j
все результаты будут в "I" -столбце
 
Ответить с цитированием