Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I use Excel 2003.
I have some data, which I intend to mark with a find, findnext loop. I find that neither bold, nor italic marks work. I have constructed some fairly simple code by editing a macro I recorded. I believe that find should not match a bold cell, but it does. ;( This is my code, which is stand alone. Option Explicit Sub Macro1() ' Workbooks.Add Cells(1, 1).Value = "foo" Cells(2, 1).Value = "fubar" Cells(3, 1).Value = "fubar" Cells(4, 1).Value = "foo" Cells(2, 1).Font.Bold = True Application.FindFormat.Clear Application.FindFormat.NumberFormat = "General" With Application.FindFormat .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With With Application.FindFormat.Font .Name = "Arial" .FontStyle = "Regular" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Application.FindFormat.Borders(xlLeft).LineStyle = xlNone Application.FindFormat.Borders(xlRight).LineStyle = xlNone Application.FindFormat.Borders(xlTop).LineStyle = xlNone Application.FindFormat.Borders(xlBottom).LineStyle = xlNone Application.FindFormat.Borders(xlDiagonalDown).Lin eStyle = xlNone Application.FindFormat.Borders(xlDiagonalUp).LineS tyle = xlNone Application.FindFormat.Interior.ColorIndex = xlNone Application.FindFormat.Locked = True Application.FindFormat.FormulaHidden = False Cells(1, 1).Activate Cells.Find(What:="fubar", LookIn:=xlFormulas, LookAt:=xlPart, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=True).Activate Debug.Print ActiveCell.Address & ", FoundStyle = " & _ ActiveCell.Font.FontStyle _ & ", DesiredStyle = " & Application.FindFormat.Font.FontStyle End Sub It writes $A$2, FoundStyle = Bold, DesiredStyle = Regular I don't understand why it does not write $A$3, FoundStyle = Regular, DesiredStyle = Regular I have not found any URL which is a good example of FindFormat. I hope the mavens here can enlighten me. Please? -- Walter Briscoe |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
PLEASE HELP! Application.speech - Everyone always ignores thisquestion | Excel Programming | |||
losing Application.FindFormat.NumberFormat after finding first cel | Excel Programming | |||
FindFormat with Borders not Working | Excel Discussion (Misc queries) | |||
Findformat | Excel Programming | |||
FindFormat | Excel Programming |