快速提问:
我设置了三个范围sourceRng1和sourceRng2 targetRng。个头都一样。
我要做到这一点:
For each cell in targetRng
cell.value = sourceRng1 / sourceRng2
next cell其中,sourceRng1和sourceRng2的索引在每次迭代中跳一步。
因此,如果sourceRng1和sourceRng2的第一个和第二个值是4 7和1 3
然后在第一次迭代中使用cell.value = 4/1。cell.value = 7/3在第二个。
对如何做这个手术有什么建议吗?
发布于 2013-07-24 15:55:07
Dim x as long
For x=1 to targetRng.cells.count
targetRng.Cells(x).value = sourceRng1.cells(x).value / sourceRng2.Cells(x).value
next cell发布于 2013-07-24 16:54:33
还有一个非VBA解决方案:
targetRng=sourceRng1 / sourceRng2

缺点是,您不能单独编辑数组公式的部分(例如删除),只有在选择整个区域=>时,才能确保使用不同的背景色或注释来区分targetRng和其他单元格。
https://stackoverflow.com/questions/17838302
复制相似问题