我的脚本编译得很好,所以我认为它没问题但是找不到它当然它在这一行上出错了,这是一个while循环中的封装,我只是想用一种简单的方法来添加一个公式到一行数据,然后做类似的事情将它添加到一行数据。有没有.Formula或者我有其他错误吗?
Cells(arow, acol).Formula = "=COUNTIF(" & wsData.Name & "!" & Cells(fdRow, acol).Address & ":" & Cells(ldRow, acol) & ")"
acol = acol + 1
答案 0 :(得分:5)
Just a few little changes needed:
.Address
on Cells(ldRow, acol)
'
around the worksheet name (only necessary if the name has spaces in it). COUNTIF
function, which I have put at the end as 1
. You'll need to update that.Here is the updated code:
Cells(arow, acol).Formula = "=COUNTIF('" & wsData.Name & "'!" & Cells(fdRow, acol).Address & ":" & Cells(ldRow, acol).Address & ",1)"