2016-10-03 5 views
-2

私は優れた細胞を持っています。 セルでは、段落が少なく、各段落で異なるフォント色を使用しています。 VBAを使用して各段落のフォントカラー値を取得するにはどうすればよいですか?ここでセルの内容の色はどのように検出できますか?

+1

申し訳ありませんが、次のWebページが私を鼓舞:http://stackoverflow.com/質問/ 26949079/vba-to-find-the-font-color-of-a-string –

+0

これを行う方法を教えてください:あなたが試したコードを投稿してください。 –

+0

@Nathan_Sav "should should"の "should have"ではありません。 – teylyn

答えて

0

は私のソリューション、Webページが文字で与えられたセルの文字でコンテンツの色を検出する方法について説明します

sheetName = "sheet1" 
Set sheet1 = Worksheets(sheetName) 
Set theCell = sheet1.Range("G18") 
text = theCell.Value 

For i = 1 To Len(text) 
    If (theCell.Characters(Start:=i, Length:=1).Font.Color = vbBlack) Then 
     '....... if the character is in black, do normal procedure 
    else 
     '........if the character does not in black, handle the exceptional case 
    end if 
next 
関連する問題