T
tim
I need the correct code for selecting and centering text
in the current row or from row current-1 to current +3
the code below centers the text in each cell entire
spreadsheed.
For lngROW = 3 To Rng.Rows.Count
cellchar = Cells(lngROW, 1).Value
If Mid(cellchar, 1, 10) = "==========" Then
ActiveWindow.SelectedSheets.HPageBreaks.Add
Before:=Cells(lngROW + 1, 1)
Application.StatusBar = "Row: " + Format(lngROW)
ElseIf Mid(cellchar, 1, 6) = "Agency" Then
For begROW = lngROW - 1 To lngROW + 3
Rows().Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Next begROW
End If
Next lngROW
in the current row or from row current-1 to current +3
the code below centers the text in each cell entire
spreadsheed.
For lngROW = 3 To Rng.Rows.Count
cellchar = Cells(lngROW, 1).Value
If Mid(cellchar, 1, 10) = "==========" Then
ActiveWindow.SelectedSheets.HPageBreaks.Add
Before:=Cells(lngROW + 1, 1)
Application.StatusBar = "Row: " + Format(lngROW)
ElseIf Mid(cellchar, 1, 6) = "Agency" Then
For begROW = lngROW - 1 To lngROW + 3
Rows().Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Next begROW
End If
Next lngROW