Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 6510

マクロ IF分岐 結果がうまく表示されない

$
0
0
I列J列、M列N列、Q列R列の、それぞれ2列ともに水色と紫色のフォントが両方あったら、U、V、W列に、う、キ、ち、とそれぞれ入力する、というマクロを作ってみたのですが、入力結果が指定した列に表示されません。添付のように「キ」がU列にきたり、「ち」がU列にきたりしています。何をどうすればいいでしょうか? Sub test() ' For nRow = 7 To 233 If Cells(nRow, 9).DisplayFormat.Font.ColorIndex = 33 And Cells(nRow, 10).DisplayFormat.Font.ColorIndex = 47 Then Cells(nRow, 21) = "う" ElseIf Cells(nRow, 10).DisplayFormat.Font.ColorIndex = 33 And Cells(nRow, 9).DisplayFormat.Font.ColorIndex = 47 Then Cells(nRow, 21) = "う" Else Cells(nRow, 21) = "" End If Next nRow For nRow = 7 To 233 If Cells(nRow, 13).DisplayFormat.Font.ColorIndex = 33 And Cells(nRow, 14).DisplayFormat.Font.ColorIndex = 47 Then Cells(nRow, 21) = "キ" ElseIf Cells(nRow, 14).DisplayFormat.Font.ColorIndex = 33 And Cells(nRow, 13).DisplayFormat.Font.ColorIndex = 47 Then Cells(nRow, 22) = "キ" Else Cells(nRow, 22) = "" End If Next nRow For nRow = 7 To 233 If Cells(nRow, 17).DisplayFormat.Font.ColorIndex = 33 And Cells(nRow, 18).DisplayFormat.Font.ColorIndex = 47 Then Cells(nRow, 21) = "ち" ElseIf Cells(nRow, 18).DisplayFormat.Font.ColorIndex = 33 And Cells(nRow, 17).DisplayFormat.Font.ColorIndex = 47 Then Cells(nRow, 23) = "ち" Else Cells(nRow, 23) = "" End If Next nRow End Sub

Viewing all articles
Browse latest Browse all 6510

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>