Board logo

標題: check whole sheet color cells and report subjects [打印本頁]

作者: williamwclee    時間: 2024-7-10 11:37     標題: check whole sheet color cells and report subjects

未命名.jpg

check whole sheet red cells
find out D4 and E5
then report
devid, 5/6/2024
tome, 7/8/2024

圖片附件: 未命名.jpg (2024-7-10 11:34, 41.57 KB) / 下載次數 106
https://h2.hkepc.com/forum/attachment.php?aid=2431148&k=7e2faa792da9ad3b533f43f2ed9b04c6&t=1781451996&sid=crJHEUCwZO


作者: unfairness    時間: 2024-7-11 10:01

首先要知道red cells係唔係淨係會出現喺column D or column E

用vba寫唔會同你check晒column A to column Z (or column ZZ),唔係晤得不過個for loop會好冇效率

via HKEPC IRF 5.1.14 - iOS(5.1.1)
作者: ivanyung    時間: 2024-7-13 17:57

  1. Sub FindRed()
  2.     Dim Target As Range
  3.     For Each Target In ActiveSheet.UsedRange
  4.         If Target.Interior.Color = vbRed Then
  5.             Debug.Print Cells(Target.Row, 1) & ", " & Cells(Target.Row, 2)
  6.         End If
  7.     Next
  8. End Sub
複製代碼





歡迎光臨 電腦領域 HKEPC Hardware (https://h2.hkepc.com/forum/) Powered by Discuz! 7.2