Sub 尋找符合條件的儲存格()
Dim rg As Range
Dim find_str As String
find_str = "鴻海"
For Each rg In ActiveSheet.UsedRange
If rg.Value Like find_str Then
Union(Selection, rg).Select
End If
Next
End Sub作者: oobird 時間: 2011-1-16 20:51
Sub YY()
Application.FindFormat.Interior.ColorIndex = 6
With ActiveSheet
For i = 1 To .Columns.Count
Set c = .Columns(i).Find(What:="", After:=.Cells(65536, i), SearchDirection:=xlNext, SearchFormat:=True)
If Not c Is Nothing Then MsgBox c.Address
Next
End With
End Sub作者: linshin1999 時間: 2011-1-17 09:25
指格子是"無填滿".即default的color index
該程式是偵察出黃色的編號,不用猜
我第二個程式,你覺得怎樣?作者: linshin1999 時間: 2011-1-17 19:08
本帖最後由 linshin1999 於 2011-1-17 19:26 編輯
candy妳好:我學會了取得儲存格顏色的方法,如果一定要用顏色找的話,可以試試看:
Dim mycolor As long
mycolor = Activecell.Interior.color
如此妳就可以取得目前儲存格的顏色,然後將這個值帶進去木工版主的程式去試試看吧!
Sub YY()
Application.FindFormat.Interior.ColorIndex = Activecell.Interior.color
With ActiveSheet
For i = 1 To .Columns.Count
Set c = .Columns(i).Find(What:="", After:=.Cells(65536, i), SearchDirection:=xlNext, SearchFormat:=True)
If Not c Is Nothing Then MsgBox c.Address
Next
End With
End Sub