Thread: for each loop
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
april april is offline
external usenet poster
 
Posts: 111
Default for each loop

i want to format each row in a spreadsheet that has the word "month" in bold.
i'm able to do it for 1 month but i want to loop through and do the other
lines with the word month
here is the macro as written--

Sub findMonth()


Dim FoundCell As Range
Dim FindWhat As String

FindWhat = "month"
With ActiveSheet.UsedRange
Set FoundCell = .Cells.Find(what:=FindWhat, _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, lookat:=xlWhole, _
searchOrder:=xlByRows, _
searchDirection:=xlNext, _
MatchCase:=False)


FoundCell.Activate
Selection.EntireRow.Select
With Selection
.HorizontalAlignment = xlRight
.WrapText = True

End With
With Selection.Font
.Name = "Cambria"
.FontStyle = "Bold"
End With
End With
End Sub

thanks in advance for your help
aprilshowers