|
各位大哥,VBA我是小白,求助,以下代码哪里有问题,为什么不能自动填充至有数据的行
Sub 周销数据同步()
'
' 周销数据同步 宏
'
'
Application.ScreenUpdating = False '防止屏幕抖动
r = Cells(Rows.Count, 3).End(xlUp).Row
Range("A1") = "品牌一二三四级类目"
Range("A2").FormulaR1C1 = "=RC[7]&RC[8]&RC[9]&RC[10]&RC[11]"
Range("A2").AutoFill Destination:=Range("A2:A" & r), Type:=xlFillDefault
Range("B1") = "大类"
Range("B2").FormulaR1C1 = _
"=IF(RC[7]=""女装"",""女装+鞋品"",IF(RC[7]=""男装"",""男装+鞋品"",IF(RC[7]=""男童"",""童装+鞋品"",IF(RC[7]=""女童"",""童装+鞋品"",IF(RC[7]=""中性"",""童装+鞋品"",IF(AND(RC[7]=""鞋品"",RC[8]=""女鞋"",RC[10]=""女拖鞋""),""女装+鞋品"",IF(AND(RC[7]=""鞋品"",RC[8]=""男鞋"",RC[10]=""男拖鞋""),""男装+鞋品"",""童装+鞋品"")))))))"
Range("B2").AutoFill Destination:=Range("B2:B" & r), Type:=xlFillDefault
Range("C1") = "日期"
Range("C2").FormulaR1C1 = "=INT(RC[4])"
Range("C2").AutoFill Destination:=Range("C2:C" & r), Type:=xlFillDefault
Range("D1") = "日"
Range("D2").FormulaR1C1 = "=TEXT(DAY(RC[3]),""00"")&""日"""
Range("D2").AutoFill Destination:=Range("D2:D" & r), Type:=xlFillDefault
Range("E1") = "直联营"
Range("E2").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[10],'辅助-店铺'!C[-1]:C,2,0),0)"
Range("E2").AutoFill Destination:=Range("E2:E" & r), Type:=xlFillDefault
Range("F1") = "年份季节"
Range("F2").FormulaR1C1 = "=RC[7]&RC[8]"
Range("F2").AutoFill Destination:=Range("F2:F" & r), Type:=xlFillDefault
Range("A2:F" & r) = Range("A2:F" & r).Value
Range("S1").Select
ActiveWorkbook.Save
End Sub
|
|