我记录了一个宏来格式化一些数据,但是范围每两周改变一次。因此,我尝试合并xldown函数来选择最后一行之前的所有数据。但是,我不确定如何将此功能合并到我当前的VBA中,任何帮助都会非常感激,因为我已经多次出现此功能。谢谢你!
Range("C2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("C3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-2]=R[-1]C[-2],R[-1]C&"",""&RC[-1],RC[-1])"
Range("C3").Select
Selection.AutoFill Destination:=Range("C3:C161")
Range("C3:C161").Select
Range("D2").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(R2C1:RC[-3],RC[-3])"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D161")
Ran
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("C2").FormulaR1C1 = "=RC[-1]"
Range("C3:C" & LastRow).FormulaR1C1 = "=IF(RC[-2]=R[-1]C[-2],R[-1]C&"",""&RC[-1],RC[-1])"
Range("D2:D" & LastRow).FormulaR1C1 = "=COUNTIF(R2C1:RC[-3],RC[-3])"