[英]Use Named range in a COUNTIFS
我遇到了需要與命名范圍(動態范圍)一起使用的countifs公式的麻煩。
因此,我已經在第一行和最后使用的行中設置了范圍,它顯然可以工作。 但是當我想在我的計數中使用這些命名范圍時,則不起作用。 只是為了幫助您理解,沒有vba的Countif看起來像這樣:= NB.SI.ENS($ F $ 28:$ F $ 400; E16; $ H $ 28:$ H $ 400;“ Topé ”)
和VBA:
Dim NoPremièreLigne As Long
Dim NoDernièreLigne As Long
Dim maplage2 As string
Dim maplage3 As string
NoPremièreLigne = 28
NoDernièreLigne = Range("F" & Rows.Count).End(xlUp).Row
Set maplage2 = "H" & NoPremièreLigne & ":" & "H" & NoDernièreLigne
Set maplage3 = "F" & NoPremièreLigne & ":" & "F" & NoDernièreLigne
Range("F16").Select
ActiveCell.FormulaR1C1 = _
"=COUNTIFS(" & maplage3 & ",E16," & maplage2 & ",""Topé"")"
這不起作用,我沒有錯誤消息,但是在單元格中我有一個#name
非常感謝您對這個問題有任何想法。
JM
應用一些基本的字符串連接並使用范圍地址。
Range("F16").Formula = _
"=COUNTIFS(" & maplage3.address & ", E16, " & maplage2.address & ", ""*Topé*"")"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.