[VBA] 弘恩



Sub mySolution()
    Dim newLinePosition As Integer
    Dim anchorcell As Range
    Dim workingCell As Range
    Dim cell As Range
    Dim myOutput As String
    
    For Each cell In Selection
        With cell
            .Offset(0, 8).Value = .Value
            .Offset(0, 9).Value = .Value
            Set anchorcell = .Offset(0, 8)
            Set workingCell = .Offset(0, 9)
        End With
        
        Do While InStr(1, workingCell.Value, Chr(10)) > 0
            myOutput = Mid(workingCell, 1, InStr(1, workingCell.Value, Chr(10)) - 1)
            anchorcell.End(xlToRight).Offset(0, 1).Value = "'" & myOutput
            
            workingCell.Replace myOutput & Chr(10), "", lookat:=xlPart
            
        Loop
        
        anchorcell.End(xlToRight).Offset(0, 1).Value = "'" & workingCell.Value
        workingCell.Clear
        
        Set anchorcell = Nothing
        Set workingCell = Nothing
    Next cell
End Sub
        
          



Source: ---


Disclaimer: The information in this webpage is shared by anonymous users from external online sources. We cannot guarantee its accuracy or truthfulness. Users should exercise caution and verify information independently.


© 2023 maginokarp.com