I'm trying to get a macro working in excel 2007 that works fine in 2003. the macro needs to find all cells with a double line border. The code to do this in 2003 was
Range("Data").Activate
' Set up formatting for "Find"
Application.FindFormat.Clear
With Application.FindFormat.Borders(xlLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 1
End With
With Application.FindFormat.Borders(xlRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 1
End With
' aRange is a found enterable cell
Set aRange = Range("Data").Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=True)
This worked but in 2007 the returned range is nothing. I have recorded a macro to find with the border I have in 2007 and have made some changes to the macro because some of the cell properties are different when viewed in 2007. My code now looks like
Range("Data").Activate
' Set up formatting for "Find"
Application.FindFormat.Clear
With Application.FindFormat.Borders(xlLeft)
.LineStyle = xlDouble
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Application.FindFormat.Borders(xlRight)
.LineStyle = xlDouble
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
' aRange is a found enterable cell
Set aRange = Range("Data").Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=True)
This does not return any range. I can though make the find work in 2007 by looking for the fill colour of a cell - but not the borders. Also the macro that I recorded will not work either - ie it will not find the cell even though it works while I am recording it. Any help on this would be gratefully received...
Bookmarks