for each loop
This should do the trick
Sub findMonth()
Dim FoundCell As Range
Dim FindWhat As String
FindWhat = "month"
For Each cell In ActiveSheet.UsedRange
If cell < Empty And InStr(LCase(cell), FindWhat) 0 Then
Set FoundCell = cell
FoundCell.Activate
Selection.EntireRow.Select
With Selection
.HorizontalAlignment = xlRight
.WrapText = True
End With
With Selection.Font
.Name = "Cambria"
.FontStyle = "Bold"
End With
End If
Next cell
End Sub
--
If this helps, please remember to click yes.
"april" wrote:
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
|