Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Cells with Specific Format
I am trying to find cells in a specific range with a specific Border
configuration. This should be simple, but the following code does not work. It finds the first such cell OK, but then proceeds to find only empty cells with no borders. This is with Office Pro 2003. Sub FindFirstLine() Worksheets("Sheet1").Activate ActiveSheet.Range("A:A").Select Application.FindFormat.Clear With Application.FindFormat.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection Set c = .Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=True) If Not c Is Nothing Then firstAddress = c.Address Do Debug.Print c.Address; Tab; c.Value Set c = .FindNext(c) If c Is Nothing Then Exit Do Loop While c.Address < firstAddress End If End With End Sub Any help will be appreciated. -- Jim Parsells |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Cells with Specific Format
Never mind. I found the answer in this forum by Dave Peterson dated 4/27/08
in reply to msg losing Application.FindFormat.Num... Thanks Dave. -- Jim Parsells "Jim Parsells" wrote: I am trying to find cells in a specific range with a specific Border configuration. This should be simple, but the following code does not work. It finds the first such cell OK, but then proceeds to find only empty cells with no borders. This is with Office Pro 2003. Sub FindFirstLine() Worksheets("Sheet1").Activate ActiveSheet.Range("A:A").Select Application.FindFormat.Clear With Application.FindFormat.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection Set c = .Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=True) If Not c Is Nothing Then firstAddress = c.Address Do Debug.Print c.Address; Tab; c.Value Set c = .FindNext(c) If c Is Nothing Then Exit Do Loop While c.Address < firstAddress End If End With End Sub Any help will be appreciated. -- Jim Parsells |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find Cells that add up to Specific Sum | Excel Worksheet Functions | |||
How to find cell with specific format? | Excel Programming | |||
Find cells with a specific character in them and conditionally format cell | Excel Programming | |||
How can I find and format specific cells automatically in Excel? | Excel Worksheet Functions | |||
Find specific cells | Excel Programming |