CellFormat object

  • Thread starter Thread starter michdenis
  • Start date Start date
M

michdenis

Hi,

Using CellFormat object, is it possible to obtain the cell addresses
affected
by this object in a sheet ?

Thank for your collaboration.


Salutations.
 
What i meant... is there a more direct way to find those
affected cells by cellformat than this kind of sub ?

'-----------------------------------
Sub ReplaceFormats()

Dim Cel As Range, Adr As String
Dim oCellFindFormat As CellFormat
Dim oCellReplaceFormat As CellFormat
Dim rngReplace As Boolean, sMessage As String

'Define variables for Find and Replace formats
Set oCellFindFormat = Application.FindFormat
Set oCellReplaceFormat = Application.ReplaceFormat

'Set the Search criteria for the Find Formats
With oCellFindFormat
.Clear
.Font.Name = "Arial"
.Interior.Color = vbRed
End With

With Feuil1.Cells
Set Cel = .Find("*", LookAt:=xlByColumns, _
after:=.Item(.Cells.Rows.Count, _
.Cells.Columns.Count), SearchFormat:=True)
If Not Cel Is Nothing Then
Adr = Cel.Address
Debug.Print Adr
Do
Set Cel = .Find("*", after:=Cel, SearchFormat:=True)
If Cel.Address <> Adr Then
Debug.Print Cel.Address
End If
Loop While Not Cel Is Nothing And Cel.Address <> Adr
End If
End With
End Sub
'-----------------------------------


"michdenis" <[email protected]> a écrit dans le message de %[email protected]...
Hi,

Using CellFormat object, is it possible to obtain the cell addresses
affected
by this object in a sheet ?

Thank for your collaboration.


Salutations.
 
Back
Top