Formating Multiple cells

  • Thread starter brownti via OfficeKB.com
  • Start date
B

brownti via OfficeKB.com

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.
 
J

Jim Rech

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
|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.aspx/excel-programming/200706/1
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top