email help vba

Excelvba12

New Member
Joined
Jan 14, 2018
Messages
1
[FONT=&quot]If I select a value from a drop-down list in the userform (the values come from a spreadsheet), how can I know if the value is for example highlighted red or green in the spreadsheet. So if it's green I send an email with contents saying 'green' but if it's red I send an email with the body saying 'red' [/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]I know how to send the email but can't work out how to identify the what colour cell it is to send the different emails. [/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]Please help[/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]Thank you [/FONT]
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
.
Here's one solution you can adapt for your purposes :

Code:
Option Explicit


Sub getcolor()


Dim myRange As Range
 Set myRange = Worksheets("Sheet1").Range("A1")
 If myRange.Interior.Color = vbRed Then
    'place your macro call here
    MsgBox "It is red"
 Else
    'place your macro call here
    MsgBox "It is green"
 End If


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top