ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trying to shade cells (https://www.excelbanter.com/excel-programming/396209-trying-shade-cells.html)

XP

Trying to shade cells
 
Using Office 2003 and Windows XP;

I have a sheet containing some 50 rows of merged cells: "G12:H12";
"G13:H13", etc. note: G to H

I want to shade them using something like:

Range(msaGLADAddress(iX)).Interior.ColorIndex = 6

Where msaGLADAddress(iX) is a module level string array containing the
address: "G13:G54"; but I get an error: cannot set the color index. Is there
a way around this? How can I shade these cells without changing the cell
address in the array?

Thanks much.

Gary''s Student

Trying to shade cells
 
Just make sure the argument of Range() is, in fact, a string and not a range.

try

MSGBOX(msaGLADAddress(iX)) first
--
Gary''s Student - gsnu200739


"XP" wrote:

Using Office 2003 and Windows XP;

I have a sheet containing some 50 rows of merged cells: "G12:H12";
"G13:H13", etc. note: G to H

I want to shade them using something like:

Range(msaGLADAddress(iX)).Interior.ColorIndex = 6

Where msaGLADAddress(iX) is a module level string array containing the
address: "G13:G54"; but I get an error: cannot set the color index. Is there
a way around this? How can I shade these cells without changing the cell
address in the array?

Thanks much.


Tom Ogilvy

Trying to shade cells
 
You can't color the interior of a subset of cells within a merged set of
cells which it sounds like you are try to do. You can try this.


For each cell in Range(msaGLADAddress(iX))
cell.mergeArea.Interior.ColorIndex = 6
Next

--
Regards,
Tom Ogilvy



"XP" wrote:

Using Office 2003 and Windows XP;

I have a sheet containing some 50 rows of merged cells: "G12:H12";
"G13:H13", etc. note: G to H

I want to shade them using something like:

Range(msaGLADAddress(iX)).Interior.ColorIndex = 6

Where msaGLADAddress(iX) is a module level string array containing the
address: "G13:G54"; but I get an error: cannot set the color index. Is there
a way around this? How can I shade these cells without changing the cell
address in the array?

Thanks much.



All times are GMT +1. The time now is 10:38 AM.

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