I am trying to create a loop Macro that will search for the word "pediatric" in Column C of each Row, and when "pediatric" is found, enter "Peds" in Column E of that row.
I created this macro using Record and then added a Loop function, but it is not working. I am getting a Loop Do syntax error when I "step into" the macro. As I'm sure will be obvious, I am very much a beginner with macros.
Can anyone please tell me what mistakes I am making here?
Thanks very much!
Sub LoopPeds()
'
' LoopPeds Macro
' Macro recorded 5/10/2008 by Mohom
'
' Keyboard Shortcut: Ctrl+w
x = 5
Do While Cells(x, 3).Value <> ""
Cells.Find(What:="Pediatric", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Cells(x, 5).Select
ActiveCell.FormulaR1C1 = "Peds"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
Cells(x, 6).Select
x = x + 1
Loop
End Sub
Bookmarks