Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default inserting a colored row with the department name

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default inserting a colored row with the department name

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating Department Payroll Howard R Excel Discussion (Misc queries) 4 March 5th 07 01:07 PM
Add to a cell if a row has a date and a column has a department Craigm[_38_] Excel Programming 2 August 6th 05 07:23 AM
Calculating Working Days - Department of Pathology Andrea Excel Discussion (Misc queries) 1 July 20th 05 07:20 PM
How to use Macro throughout Department Dave Peterson[_5_] Excel Programming 0 March 22nd 05 12:16 AM
Cell right next to colored cells is automatically colored on entering a value Johan De Schutter Excel Programming 6 September 12th 03 05:31 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"