ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting color of each cell in selection (https://www.excelbanter.com/excel-programming/359856-getting-color-each-cell-selection.html)

Brian J. Matuschak

Getting color of each cell in selection
 
Greetings:

In trying to modify and copy some code posted on this board, I'm
unsuccessful in trying to get the color of each cell and throw an error
message. Based on the user needs, I need them to select a range of cells
(fortunately, in the same row), click a command button, and then send an
Outlook appointment item--that part's easy.

So, recipients that are properly scheduled have their cells changed to
green; others are orange. Thus, this is what I'm trying to do in the sub:

Dim rng As Range

For Each rng in Selection
If rng.Interior.ColorIndex < 4
--
Brian J. Matuschak


Chip Pearson

Getting color of each cell in selection
 
What problem are you having? The code you posted should work.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Brian J. Matuschak"
wrote in message
...
Greetings:

In trying to modify and copy some code posted on this board,
I'm
unsuccessful in trying to get the color of each cell and throw
an error
message. Based on the user needs, I need them to select a
range of cells
(fortunately, in the same row), click a command button, and
then send an
Outlook appointment item--that part's easy.

So, recipients that are properly scheduled have their cells
changed to
green; others are orange. Thus, this is what I'm trying to do
in the sub:

Dim rng As Range

For Each rng in Selection
If rng.Interior.ColorIndex < 4
--
Brian J. Matuschak




Brian J. Matuschak

Getting color of each cell in selection
 
Here's the full snippet that I posted in a message a couple of minutes later:
Dim rng As Range

For Each rng in Selection
If rng.Interior.ColorIndex < 4 Then
MsgBox "You did not select the correct cells for scheduling",
vbCritical, "Improper Selection"
End If
Exit Sub
Next


Basically, it just skips over the code.

Thanks for your reply,
--
Brian J. Matuschak



"Chip Pearson" wrote:

What problem are you having? The code you posted should work.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Brian J. Matuschak"
wrote in message
...
Greetings:

In trying to modify and copy some code posted on this board,
I'm
unsuccessful in trying to get the color of each cell and throw
an error
message. Based on the user needs, I need them to select a
range of cells
(fortunately, in the same row), click a command button, and
then send an
Outlook appointment item--that part's easy.

So, recipients that are properly scheduled have their cells
changed to
green; others are orange. Thus, this is what I'm trying to do
in the sub:

Dim rng As Range

For Each rng in Selection
If rng.Interior.ColorIndex < 4
--
Brian J. Matuschak





Brian J. Matuschak

Getting color of each cell in selection
 
D'OH! Thanks for your help.
--
Brian J. Matuschak



"Brian J. Matuschak" wrote:

Here's the full snippet that I posted in a message a couple of minutes later:
Dim rng As Range

For Each rng in Selection
If rng.Interior.ColorIndex < 4 Then
MsgBox "You did not select the correct cells for scheduling",
vbCritical, "Improper Selection"
End If
Exit Sub
Next


Basically, it just skips over the code.

Thanks for your reply,
--
Brian J. Matuschak



"Chip Pearson" wrote:

What problem are you having? The code you posted should work.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Brian J. Matuschak"
wrote in message
...
Greetings:

In trying to modify and copy some code posted on this board,
I'm
unsuccessful in trying to get the color of each cell and throw
an error
message. Based on the user needs, I need them to select a
range of cells
(fortunately, in the same row), click a command button, and
then send an
Outlook appointment item--that part's easy.

So, recipients that are properly scheduled have their cells
changed to
green; others are orange. Thus, this is what I'm trying to do
in the sub:

Dim rng As Range

For Each rng in Selection
If rng.Interior.ColorIndex < 4
--
Brian J. Matuschak






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

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