Format question

  • Thread starter Thread starter Regina
  • Start date Start date
R

Regina

I'm using 2002 and would like to do the following:
We have PN: ####### hundreds of times in our spreadsheets
and have been directed to make the PN: ####### line (out
of 6 lines) bold. Is there a quick search and replace
function to use in Excel even though the #'s after PN:
will be different every time?
thank you in advance for any help you can provide!
Regina
 
you could use a macro like this:

Public Sub BoldPN()
Const sSEARCH As String = "PN:"
Dim rFound As Range
Dim sFirst As String
With ActiveSheet.Cells
Set rFound = .Find( _
What:=sSEARCH, _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=False)
If Not rFound Is Nothing Then
sFirst = rFound.Address
Do
rFound.Font.Bold = True
Set rFound = .FindNext(after:=rFound)
Loop Until rFound.Address = sFirst
End If
End With
End Sub

If you're not familiar with macros, take a look at

http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
I'm sorry, I should've been more specific. When I ran the
macro, the whole cell became bold. What I should've
written is that the PN: #### that needs to be bold is in a
cell with other lines, where we hit Alt Enter as a return
to next line, so it appears like this but all in one cell:
Kit Label 213
Equipment, PN: #######
VXYIMY
Quantity: 8
Can you help?
thanks so much,
Regina
 
Back
Top