ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   use VBA color the cells (https://www.excelbanter.com/excel-programming/360557-use-vba-color-cells.html)

Sarah[_6_]

use VBA color the cells
 
Hi,

I have an excel file, user enters numbers or letters. I like to have a macro
to color all the cells with the letter "U" at the end. Please help.

Thanks so much,

Sarah



Don Guillett

use VBA color the cells
 
try
Sub colorifU()
For Each c In Selection
If UCase(Right(c, 1)) = "U" Then c.Interior.ColorIndex = 6
Next c
End Sub

--
Don Guillett
SalesAid Software

"Sarah" wrote in message
...
Hi,

I have an excel file, user enters numbers or letters. I like to have a
macro to color all the cells with the letter "U" at the end. Please help.

Thanks so much,

Sarah




Sarah[_6_]

use VBA color the cells
 
Hi Don,

Thanks for your quick response. I'm new to vba, can you give me the full
sample code, I don't quite follow it.

Thanks,
Sarah
"Don Guillett" wrote in message
...
try
Sub colorifU()
For Each c In Selection
If UCase(Right(c, 1)) = "U" Then c.Interior.ColorIndex = 6
Next c
End Sub

--
Don Guillett
SalesAid Software

"Sarah" wrote in message
...
Hi,

I have an excel file, user enters numbers or letters. I like to have a
macro to color all the cells with the letter "U" at the end. Please help.

Thanks so much,

Sarah






Sarah[_6_]

use VBA color the cells
 
Hi Don,

Please ignore my message, I figured it out, Thanks again
"Don Guillett" wrote in message
...
try
Sub colorifU()
For Each c In Selection
If UCase(Right(c, 1)) = "U" Then c.Interior.ColorIndex = 6
Next c
End Sub

--
Don Guillett
SalesAid Software

"Sarah" wrote in message
...
Hi,

I have an excel file, user enters numbers or letters. I like to have a
macro to color all the cells with the letter "U" at the end. Please help.

Thanks so much,

Sarah






Bob Phillips[_14_]

use VBA color the cells
 
That is it. Go to the VBIDE (ALt-F11), open a code module (InsertModule),
and copy the code in. Then in Excel, select your data and run the macro
(ToolsMacroMacros..., select ColorifU and hit Run).

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Sarah" wrote in message
...
Hi Don,

Thanks for your quick response. I'm new to vba, can you give me the full
sample code, I don't quite follow it.

Thanks,
Sarah
"Don Guillett" wrote in message
...
try
Sub colorifU()
For Each c In Selection
If UCase(Right(c, 1)) = "U" Then c.Interior.ColorIndex = 6
Next c
End Sub

--
Don Guillett
SalesAid Software

"Sarah" wrote in message
...
Hi,

I have an excel file, user enters numbers or letters. I like to have a
macro to color all the cells with the letter "U" at the end. Please

help.

Thanks so much,

Sarah








Don Guillett

use VBA color the cells
 
glad to help

--
Don Guillett
SalesAid Software

"Sarah" wrote in message
...
Hi Don,

Please ignore my message, I figured it out, Thanks again
"Don Guillett" wrote in message
...
try
Sub colorifU()
For Each c In Selection
If UCase(Right(c, 1)) = "U" Then c.Interior.ColorIndex = 6
Next c
End Sub

--
Don Guillett
SalesAid Software

"Sarah" wrote in message
...
Hi,

I have an excel file, user enters numbers or letters. I like to have a
macro to color all the cells with the letter "U" at the end. Please
help.

Thanks so much,

Sarah









All times are GMT +1. The time now is 12:28 PM.

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