Finding a formatted cell with VBA

Joined
Jul 27, 2006
Messages
1
Reaction score
0
Good morning,
I'm new here and I know just enough Excel VBA to get me though.

However, I'm stumped this morning. Any and all help would be greatly appreciated and thank you in advance for your help.

I want to find the first Blue (color 41) cell using the Find function in Excel. I can do that and it works fine, but I wanted to have it done in a macro.

Here's the code that Excel created:

Sub OL_Find_BlueFormat1()
'
' OL_Find_BlueFormat1 Macro
' Macro recorded 7/27/2006 by Jay D
'
'
Range("B5").Select
With Application.FindFormat.Interior
.ColorIndex = 41
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate
ActiveCell.Offset(-1, 0).Range("A1:AB1").Select
Range(Selection, Selection.End(xlUp)).Select
End Sub

The problem is that it gets stuck on this part when I rerun the macro.
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate

Any ideas how to fix this?

Thanks, Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top