在COUNTIFS中使用命名范围

时间:2018-03-01 10:09:05

标签: excel-vba vba excel

我遇到了需要与命名范围(动态范围)一起使用的countifs公式的问题。

所以我设置了第一行和最后一行使用的范围,它显然有效。 但是当我想在我的计数中使用这些命名范围时,它就不起作用了。 只是为了帮助你理解,没有vba的countif看起来像这样: = NB.SI.ENS($ F $ 28:$ F $ 400; E16; $ H $ 28:$ H $ 400; “ TOPE ”)

并使用VBA:

var images = [
  "http://helenspeyer.co.uk/wp-content/gallery/the-end-of-the-f-ing-world/The-end-of-the-f...ing-world-2-Large.jpg",
  "http://helenspeyer.co.uk/wp-content/gallery/the-end-of-the-f-ing-world/The-end-of-the-f...ing-world-6-Large.jpg",
  "http://helenspeyer.co.uk/wp-content/gallery/the-end-of-the-f-ing-world/The-end-of-the-f...ing-world-1-Large.jpg"
]

for (var i = 0; i < images.length; i++) {
  $("#changeBg").click(function() {
    $("body").css("background-image", "images.length[i]");
  } 

并且这不起作用,我没有错误消息,但在单元格中我有一个#name

如果你对这个问题有任何想法,那么非常感谢....

JM

1 个答案:

答案 0 :(得分:1)

应用一些基本字符串连接并使用范围地址。

Range("F16").Formula = _
  "=COUNTIFS(" & maplage3.address & ", E16, " & maplage2.address & ", ""*Topé*"")"