View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Janis Janis is offline
external usenet poster
 
Posts: 360
Default inserting a colored row with the department name

thanks,

"JLGWhiz" wrote:

Not quite sure what you are trying with : .Rows(2).Insert.Interior.ColorIndex
= 15

To get gray in row 2 use: ActiveSheet.Rows(2).Interior.ColorIndex = 15

To align text in the center horizontally, add this line of code in your With
statment:

.HorizontalAlignment = xlHAlignCenter

"Janis" wrote:

This piece of code works in my macro however I need the interior color of the
row to be gray. I tried .interior.colorindex = gray after the insert and it
did it but then stopped and I got an error. Also, the name of the department
is in what is row 2, cell 17, but after the header row is inserted then it is
now row 3. This name is the value of the row header.
In this code it does not put the value in the row. I want it to be in the
center of the row.
Thanks very much for your help,

.Rows(2).Insert.Interior.ColorIndex = 15

With .Cells(3, 4)
.Value = .Cells(3, 17)
.Font.Bold = True
.Font.Size = 14
.RowHeight = 18
.Font.Color = vbWhite
End With