ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formating Multiple cells (https://www.excelbanter.com/excel-programming/390822-formating-multiple-cells.html)

brownti via OfficeKB.com

Formating Multiple cells
 
I know there is a better way to do this, but i dont know how.

Sub closerlabel()
ActiveCell.Offset(columnoffset:=3).Select
Selection.Value = "* Closer Reinforcement"
ActiveCell.Offset(0, 2).Select
With ActiveCell
.Interior.ColorIndex = 41
.Font.ColorIndex = 2
End With
ActiveCell.Offset(0, 1).Select
With ActiveCell
.Interior.ColorIndex = 41
.Font.ColorIndex = 2
End With
ActiveCell.Offset(0, 1).Select
With ActiveCell
.Interior.ColorIndex = 41
.Font.ColorIndex = 2
End With
ActiveCell.Offset(rowoffset:=1, columnoffset:=-3).Select
End Sub

thoughts? Thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1


Jim Rech

Formating Multiple cells
 
Generally the pros eschew needless selecting.

Sub Alternative()
With ActiveCell
.Offset(0, 3).Value = "* Closer Reinforcement"
With .Offset(0, 5).Resize(1, 3)
.Interior.ColorIndex = 41
.Font.ColorIndex = 2
End With
End With
End Sub


--
Jim
"brownti via OfficeKB.com" <u31540@uwe wrote in message
news:734e08149cb64@uwe...
|I know there is a better way to do this, but i dont know how.
|
| Sub closerlabel()
| ActiveCell.Offset(columnoffset:=3).Select
| Selection.Value = "* Closer Reinforcement"
| ActiveCell.Offset(0, 2).Select
| With ActiveCell
| .Interior.ColorIndex = 41
| .Font.ColorIndex = 2
| End With
| ActiveCell.Offset(0, 1).Select
| With ActiveCell
| .Interior.ColorIndex = 41
| .Font.ColorIndex = 2
| End With
| ActiveCell.Offset(0, 1).Select
| With ActiveCell
| .Interior.ColorIndex = 41
| .Font.ColorIndex = 2
| End With
| ActiveCell.Offset(rowoffset:=1, columnoffset:=-3).Select
| End Sub
|
| thoughts? Thanks.
|
| --
| Message posted via OfficeKB.com
| http://www.officekb.com/Uwe/Forums.a...mming/200706/1
|




All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com