假设我在B2单元格中有这个公式
=IFERROR(MID($A2,FIND("|",SUBSTITUTE($A2,"@","|",B$1)),IFERROR(FIND(" ",$A2,FIND("|",SUBSTITUTE($A2,"@","|",B$1))),LEN($A2)+1)-FIND("|",SUBSTITUTE($A2,"@","|",B$1))),"")
在VBA<我如何将其复制到最后一行并跨越(包括P列)
我见过一些例子,它显示的是一列但不是多列,例如VBA to fill formula down till last row in column
答案 0 :(得分:1)
假设行数由A列中的数据确定,则尝试:
Dim lRow As Long
With ActiveSheet
lRow = .Cells(Rows.Count, 1).End(xlUp).Row
.Range("B2:P" & lRow).FormulaR1C1 = "=IFERROR(MID(RC1,FIND(""|"",SUBSTITUTE(RC1,""@"",""|"",R1C)),IFERROR(FIND("" "",RC1,FIND(""|"",SUBSTITUTE(RC1,""@"",""|"",R1C))),LEN(RC1)+1)-FIND(""|"",SUBSTITUTE(RC1,""@"",""|"",R1C))),"""")"
End With