Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Cells that add up to Specific Sum BeachLover Excel Worksheet Functions 5 January 2nd 09 03:23 PM
How to find cell with specific format? NOPIK Excel Programming 3 March 9th 07 09:21 PM
Find cells with a specific character in them and conditionally format cell RITCHI Excel Programming 2 February 11th 07 01:20 PM
How can I find and format specific cells automatically in Excel? Amy Excel Worksheet Functions 1 August 6th 05 03:00 PM
Find specific cells sirjadin26 Excel Programming 10 June 18th 05 08:40 PM


All times are GMT +1. The time now is 11:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"