20170501xlVBA Sales order organize one line to go to multiple lines

Source: Internet
Author: User
Tags chr

Sub nextseven_codeframe () application.screenupdating = False Application.DisplayAlerts = False Application.calcul ation = xlcalculationmanual Application.statusbar = ">>>>>>>> program is running >>>>>> >> "on Error GoTo errhandler Dim StartTime, usedtime as Variant StartTime = VBA. Timer ' >>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Dim Wb As Workbook Dim Sht As Worksheet Dim Osht As Worksheet Dim Rng As Range ' Dim Arr As Variantdim arr () Dim endrow As Long Con St Head_row as Long = 1 Const sheet_name As String = "original order" Const start_column As String = "a" const end_column a s String = "O" Dim i As Long, j as long, K as Long Dim N As Long ConSt Other_head_row as Long = 1 Const other_sheet_name As String = "Finishing order" Const Other_start_column As String = "A" Const Other_end_column as String = "O" ' >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >> ' Get original record set Wb = Application.thisworkbook Set Sht = Wb.worksheets (sheet_name) with Sht Endrow = . Cells (. Cells.Rows.Count, 1). End (Xlup). Row Set Rng =. Range (. Cells (Head_row + 1, start_column),. Cells (Endrow, End_column)) ' arr = Rng.value ReDim arr (1 to Rng.Rows.Count, 1 to Rng.Columns.Count) Wi Th Rng for i = 1 to. Rows.Count for j = 1 to. Columns.count Arr (i, j) =. Cells (i, J). Text Next J Next i End With End with ' >>>>>>>>>>>>>>>>>>>>>>>>& Gt;>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>> ' Generate new record Dim BRR ()        As String ReDim BRR (1 to 1-1) N = 0 for i = LBound (arr) to UBound (arr) Key = CStr (arr (i, 2))            ' Judgment Chr ' If InStr (1, Key, CHR (ten)) = 0 Then n = n + 1 ReDim Preserve brr (1 to, 1 to N) For j = 1 to Brr (j, N) = Arr (i, J) Next J Else CRR = Split (Key,  CHR) for k = LBound (CRR) to UBound (CRR) n = n + 1 ReDim Preserve brr (1 to 15,                            1 to N) if-k = 0 Then-for-j = 1 to-if J = 2 Then           Brr (j, N) = CRR (k)             Else Brr (j, N) = Arr (i, j) End If Next J Else BRR (2, N) = CRR (k) brr (+, N) = ARR (i, +) b RR (N) = ARR (i, i) End If Next k end If Next i for i = LBound (BRR, 2) to UBound (BRR, 2) brr (+, I) = Replace (BRR (+, i), "Shenzhen-shun Fung International parcel registered", "USPS") Next i ' &GT;&GT;&GT;&GT;&GT;&GT;&GT;&G T;>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>            >>>>>>>>>>>>> Set Osht = wb.worksheets (other_sheet_name) with Osht . Usedrange.offset (1). Clearcomments. Range ("A2"). Resize (UBound (BRR, 2), UBound (BRR)).           Value = _ Application.WorksheetFunction.Transpose (BRR) . UsedRange.Columns.AutoFit End with ' >>>>>>>>>>>>>>>>>>>& Gt;>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >> usedtime = VBA. Timer-starttime MsgBox "Time-consuming:" & Format (Usedtime, "0.000 seconds"), vbOKOnly, "Nextseven Excel Studio" Errorexit:set Wb = Nothing Set Sht = Nothing Set Rng = Nothing Set Osht = Nothing application.screenupdating = True appli cation. DisplayAlerts = True Application.calculation = xlcalculationautomatic Application.statusbar = False Exit Sub ' >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>errhandler:if err.number <> 0 then MsgBox err.description & "! ", vbcritical," Nextseven Excel Studio "' Debug.Print err.description err.clear Resume errorexit E nd ifend Sub

  

20170501xlVBA Sales order organize one line to go to multiple lines

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.