2017-06-12 37 views
-1

VBで= countcolourスクリプトを使用しました。例: "= countcolour(a1:a10、b1)" b1は緑を、結果は緑のセルを6とします。 「A1:A10」にランダムに「G」のセル値が入力されている場合、カウントカラー結果内の「G」をどのように計算できますか?私はcountcolour(VBスクリプト)の結果を持っていますが、その結果内でcountif結果を得るにはどうすればいいですか?

+2

Excelで作業している場合、それはVBではありません。ネット。タグのテキストは使用方法のガイダンスを提供します。 [ask]を読んで[tour] – Plutonix

答えて

0

私はあなたが後にしているものを理解し、それはCOUNTIFSワークシート式の同等だ場合、次のコードは動作します絶対にわからない:

Sub SumCountByConditionalFormat() 
Dim refColor As Long 
Dim rng As Range 
Dim countRng As Range 
Dim countCol As Long 

Set countRng = Sheet1.Range("$A$1:$A$10") 

    refColor = Sheet1.Range("$B$1").DisplayFormat.Interior.Color 
    For Each rng In countRng 
     If rng.DisplayFormat.Interior.Color = refColor And rng.Value = "g" Then 
      countCol = countCol + 1 
     End If 
    Next 
    MsgBox countCol 

End Sub 
関連する問題