I am trying to develop a Macro to find specific text in all Worksheets within a Workbook and style the text bold.
Here is what i have currently which works fine:
Sub Style_Worksheets()
Dim ws As Worksheet
For Each ws In Sheets
ws.Activate
Dim sCellVal As String
sCellVal = Range("A1").Value
sCellVal = Range("A5").Value
sCellVal = Range("A7").Value
sCellVal = Range("B7").Value
If sCellVal Like "*Workflow Name:*" Or _
sCellVal Like "Events*" Or _
sCellVal Like "Event Name*" Or _
sCellVal Like "Tag File*" Then
Range("A1").Font.Bold = True
Range("A5").Font.Bold = True
Range("A7").Font.Bold = True
Range("B7").Font.Bold = True
End If
Next ws
End Sub
Now the problem I am currently facing is that I have specific text that in one Worksheet is in cell A16, but in another Worksheet is in A10.
I have over 100 Worksheets that need styling, and the specific text is in different cells for each Worksheet.
I would like the Macro to find specific text between cells A10 and A16 and if it finds the text, I want it to style it bold.
I have tried adding the following into its relevant places:
sCellVal = Range("A10:A16").Value
and:
sCellVal Like "Workflow Level Mappings*" Or _
and:
Range("A10:A16").Font.Bold = True
...but no joy.
Can anyone help me out?
Thanks,
A
Find
method which will look for your specified text - looks like you'll need to loop if you have several alternative bits of text to look for. – SJR