返回列表 上一主題 發帖

[發問] 請問如何更改這一個range的數值

回復 1# joseph2003

這種問題應該使用格式化條件即可達成
若一定要使用VBA
  1. Sub Find_Num()
  2. For Each a In Range("A:AI").SpecialCells(xlCellTypeConstants)
  3.   r = Int((a.Row - 1) / 5) + 1
  4.   Set c = Sheets(2).Rows(r).Find(a)
  5.   If Not c Is Nothing Then a.Interior.ColorIndex = 3 Else a.Interior.ColorIndex = 0
  6. Next
  7. End Sub
複製代碼
附件中含有格式化條件作法
findcell.rar (10.12 KB)
學海無涯_不恥下問

TOP

回復 3# joseph2003
  1. Sub Find_Num()
  2. For Each a In Range("A:AI").SpecialCells(xlCellTypeConstants)
  3.   r = Int((a.Row - 1) / 5) + 1
  4.   Set c = Sheets(2).Rows(r).Find(a, lookat:=xlWhole)
  5.   If Not c Is Nothing Then a.Interior.ColorIndex = 3 Else a.Interior.ColorIndex = -4142
  6. Next
  7. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 道德是提昇自我的明燈,不該是呵斥別人的鞭子。
返回列表 上一主題