中易网

EXCEL 用VBA编写自动填充公式功能

答案:4  悬赏:10  
解决时间 2021-01-15 17:25
  • 提问者网友:相思似海深
  • 2021-01-14 19:30
EXCEL 用VBA编写自动填充公式功能
最佳答案
  • 二级知识专家网友:酒安江南
  • 2021-01-14 20:48
看了下你的公式运行方式,就是对比是否在C列里有B列的相同数据,有就在第9列写个"0"。写得也怪怪的。帮你改下这样
Private Sub Worksheet_Activate()
For n = 2 To [b65535].End(xlUp).Row
Cells(n, 2).Select
Cells(n, 9) = Evaluate("=IF(COUNTIF(C:C,INDEX(B:B,ROW()))>0,0,"""")")
Cells(n, 8) = Evaluate("你的excel公式")
Cells(n, 10) = Evaluate("你的excel公式")
Cells(n, 11) = Evaluate("你的excel公式")
NextEnd Sub追问呃,可以留一下你的Q吗?我想详细跟你请教一下追答24278528
全部回答
  • 1楼网友:第四晚心情
  • 2021-01-14 23:56
y=range("A65536").end(xlup).row
for m=2 to y
cells(m,8).FormulaR1C1=你的公式
cells(m,9).FormulaR1C1=
cells(m,10).FormulaR1C1=
cells(m,11).FormulaR1C1=
next
  • 2楼网友:污到你湿
  • 2021-01-14 23:37
cells(1,8).resize([a65536].end(3).row,4).filldown
这样?不过你好像第9列另有安排哎
  • 3楼网友:琴狂剑也妄
  • 2021-01-14 22:27
Private Sub Worksheet_Activate()
Dim i, n, x As Integer
x = [c1048576].End(xlUp).Row
For i = x To 2 Step -1
If Cells(i, 2) = Cells(i, 3) Then
Cells(i, 9) = "0"
Exit For
End If
if cells(i,1)<>"" then
range(cells(i,8),cells(i,11)=i
end if
Next
Next
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息