1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
| Sub 抖店数据处理() Application.ScreenUpdating = False Dim yearValue As Integer Dim lastRow As Long lastRow = Cells(Rows.Count, "E").End(xlUp).Row For i = lastRow To 2 Step -1 yearValue = Year(Cells(i, "E").Value) If yearValue = 1970 Then Cells(i, "E").EntireRow.Delete End If Next i ActiveSheet.usedRange.Columns("F:AO").Value = ActiveSheet.usedRange.Columns("F:AO").Value Cells.AutoFilter Application.ActiveSheet.AutoFilter.Sort.SortFields.Add Key:=Range( _ "D1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal With Application.ActiveSheet.AutoFilter.Sort .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Columns("E:E").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Columns("G:G").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Columns("D:D").TextToColumns Destination:=Range("D1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _ Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _ :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True Columns("F:F").TextToColumns Destination:=Range("F1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _ Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _ :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True Range("D1").Select ActiveCell.FormulaR1C1 = "直播日期" Range("E1").Select ActiveCell.FormulaR1C1 = "开始时间" Range("G1").Select ActiveCell.FormulaR1C1 = "结束时间" Columns("I:I").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("I1").Select ActiveCell.FormulaR1C1 = "直播时长(小时)" Range("I2:I" & [e65536].End(xlUp).Row).Select selection.FormulaR1C1 = "=RC[-1]/60" Columns("Q:Q").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("Q1").Select ActiveCell.FormulaR1C1 = "人均观看时长(秒)" Range("Q2:Q" & [e65536].End(xlUp).Row).Select selection.FormulaR1C1 = "=RC[1]*60" Columns("AD:AD").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("AD1").Select ActiveCell.FormulaR1C1 = "直播间成交金额(含预售)" Range("AD2:AD" & [e65536].End(xlUp).Row).Select selection.FormulaR1C1 = "=RC[1]+RC[16]" Columns("AC:AC").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("AC1").Select ActiveCell.FormulaR1C1 = "直播间成交订单数(含预售)" Range("AC2:AC" & [e65536].End(xlUp).Row).Select selection.FormulaR1C1 = "=RC[1]+RC[17]" With ActiveSheet .usedRange.Columns("I").Value = .usedRange.Columns("I").Value .usedRange.Columns("Q").Value = .usedRange.Columns("Q").Value .usedRange.Columns("AC").Value = .usedRange.Columns("AC").Value .usedRange.Columns("AE").Value = .usedRange.Columns("AE").Value End With Range("I2:I" & [e65536].End(xlUp).Row).NumberFormatLocal = "0.0" Range("W2:W" & [e65536].End(xlUp).Row).NumberFormatLocal = "0.0%" Cells.EntireColumn.AutoFit Cells.EntireRow.AutoFit Range("A:C,F:F,H:H,K:K,M:M,R:R,T:T,V:V,X:X,AA:AB,AD:AD,AF:AH,AJ:AJ,AL:AU").Select selection.EntireColumn.Hidden = True Range("E2").Select ActiveWindow.FreezePanes = True Range("D1").Select ActiveWorkbook.Save Application.ScreenUpdating = True End Sub
|