ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   changing properties of offset cells (https://www.excelbanter.com/excel-programming/411105-changing-properties-offset-cells.html)

MJKelly

changing properties of offset cells
 
Hi,

Instead of using the code below, is there a way of setting the
colorindex of offset(0,0) to offset(,4)?

Err.Offset(0, 0).Interior.ColorIndex = 3
Err.Offset(0, 1).Interior.ColorIndex = 3
Err.Offset(0, 2).Interior.ColorIndex = 3
Err.Offset(0, 3).Interior.ColorIndex = 3
Err.Offset(0, 4).Interior.ColorIndex = 3

kind regards,
Matt

Dana DeLouis

changing properties of offset cells
 
I think this does the same as you code:

Err.Resize(1, 5).Interior.ColorIndex = 3

--
HTH :)
Dana DeLouis


"MJKelly" wrote in message ...

Hi,

Instead of using the code below, is there a way of setting the
colorindex of offset(0,0) to offset(,4)?

Err.Offset(0, 0).Interior.ColorIndex = 3
Err.Offset(0, 1).Interior.ColorIndex = 3
Err.Offset(0, 2).Interior.ColorIndex = 3
Err.Offset(0, 3).Interior.ColorIndex = 3
Err.Offset(0, 4).Interior.ColorIndex = 3

kind regards,
Matt

MJKelly

changing properties of offset cells
 
Yes it works, thanks very much.

Matt

Dave Peterson

changing properties of offset cells
 
You may want to avoid using err as your range variable name. Excel's VBA
already has an Err object.

MJKelly wrote:

Hi,

Instead of using the code below, is there a way of setting the
colorindex of offset(0,0) to offset(,4)?

Err.Offset(0, 0).Interior.ColorIndex = 3
Err.Offset(0, 1).Interior.ColorIndex = 3
Err.Offset(0, 2).Interior.ColorIndex = 3
Err.Offset(0, 3).Interior.ColorIndex = 3
Err.Offset(0, 4).Interior.ColorIndex = 3

kind regards,
Matt


--

Dave Peterson

MJKelly

changing properties of offset cells
 
Thanks Dave, I'll bear that in mind.

kind regards,
Matt


All times are GMT +1. The time now is 02:00 AM.

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