Finding each cell where a style is used

Graham.Johnson

New Member
Joined
Jun 29, 2010
Messages
3
Hello,
I am trying to find each location where a style is used and SELECTIVELY replace that style (one by one, manually) with another style.
I am not trying to replace all usages of one style with another style, blindly.
Is that possible?
Many thanks.
Keith
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
here is some vba to tell you which cells are a certain style
run from the sheet containing the styles you want to change and when the input box appears enter the name of the style to be listed

Code:
Sub ListCells()
    Dim Cel As Range, Rng As Range, Ws As Worksheet, r As Long, myStyle As String
    Set Rng = ActiveSheet.UsedRange
    myStyle = UCase(InputBox("Enter style name", "?", "accent2"))
    With Sheets.Add
        For Each Cel In Rng
            If UCase(Cel.Style) = myStyle Then
                r = r + 1
                .Cells(r, 1).Resize(, 2) = Array(Cel.Address(0, 0), Cel.Style)
            End If
        Next Cel
    End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,165
Messages
6,129,250
Members
449,497
Latest member
The Wamp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top