ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why doesn't this color set work? (https://www.excelbanter.com/excel-programming/371350-why-doesnt-color-set-work.html)

Maury Markowitz

Why doesn't this color set work?
 
"It" is set it = activesheet (just so I have a short form). Later in my code
there are these two lines:

it.Cells(i, 13).AddComment "OK"
it.Cells(i, 13).Interior.Color = 13434828

the first one works fine, the second one gives an "application error" and
exits.

I use similar code all over my apps. What is wrong with this example?

Maury

Bob Phillips

Why doesn't this color set work?
 
Can't see anything, works fine for me. What code do you have before it?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Maury Markowitz" wrote in
message ...
"It" is set it = activesheet (just so I have a short form). Later in my

code
there are these two lines:

it.Cells(i, 13).AddComment "OK"
it.Cells(i, 13).Interior.Color = 13434828

the first one works fine, the second one gives an "application error" and
exits.

I use similar code all over my apps. What is wrong with this example?

Maury




Dave Peterson

Why doesn't this color set work?
 
The second line worked ok for me.

Any chance you've protected that worksheet (allowing objects/comments to be
updated)?





Maury Markowitz wrote:

"It" is set it = activesheet (just so I have a short form). Later in my code
there are these two lines:

it.Cells(i, 13).AddComment "OK"
it.Cells(i, 13).Interior.Color = 13434828

the first one works fine, the second one gives an "application error" and
exits.

I use similar code all over my apps. What is wrong with this example?

Maury


--

Dave Peterson

Maury Markowitz

Why doesn't this color set work?
 
"Dave Peterson" wrote:

The second line worked ok for me.


Urrrg. Ok, thanks for trying guys, I guess it's just one of those mysteries.
No, there's no protection or anything, and you get the generic "application
defined error" (thanks MS!)

Maury

NickHK

Why doesn't this color set work?
 
No, works fine for me, XL2K.
You're not trying to run it on a cell that already has a comment, are you ?
Or i is not a valid row ?

NickHK

"Maury Markowitz" wrote in
message ...
"Dave Peterson" wrote:

The second line worked ok for me.


Urrrg. Ok, thanks for trying guys, I guess it's just one of those

mysteries.
No, there's no protection or anything, and you get the generic

"application
defined error" (thanks MS!)

Maury





All times are GMT +1. The time now is 01:50 PM.

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