Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is there a boolean expression that will do this? Cells yellow with an A or not. Thanks Howard Sub CellColLetter() '/ Ctrl + q With Selection If Selection.Interior.ColorIndex < 6 Then Selection.Interior.ColorIndex = 6 Selection = "A" Else Selection.Interior.ColorIndex = xlNone Selection.ClearContents End If End With End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Howard,
Am Sun, 26 Apr 2015 08:33:49 -0700 (PDT) schrieb L. Howard: Is there a boolean expression that will do this? Cells yellow with an A or not. try: Private Sub Worksheet_Change(ByVal Target As Range) Target.Interior.ColorIndex = IIf(Target = "A", 6, xlNone) End Sub If this is not the expected soluntion please post more informations Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try:
Private Sub Worksheet_Change(ByVal Target As Range) Target.Interior.ColorIndex = IIf(Target = "A", 6, xlNone) End Sub If this is not the expected soluntion please post more informations The user will select the cells of choice and run a macro with a short cut key. So target does not work nor change event' Howard |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Howard,
Am Sun, 26 Apr 2015 09:07:18 -0700 (PDT) schrieb L. Howard: The user will select the cells of choice and run a macro with a short cut key. what should the macro do? Write a A in a yellow cell or color cells with A yellow? Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sunday, April 26, 2015 at 9:07:23 AM UTC-7, L. Howard wrote:
try: Private Sub Worksheet_Change(ByVal Target As Range) Target.Interior.ColorIndex = IIf(Target = "A", 6, xlNone) End Sub If this is not the expected soluntion please post more informations The user will select the cells of choice and run a macro with a short cut key. So target does not work nor change event' Howard Just to add, a user will select cells and run the macro, a color will be installed along with a letter. (probably the persons initial and the color may be a coding thing) So if I select four cells and hit my Ctrl + q short cut, then cells are yellow with my letter in them. If I select those same cells later and run the code then no color and no letter. Howard |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Howard,
Am Sun, 26 Apr 2015 09:14:41 -0700 (PDT) schrieb L. Howard: So if I select four cells and hit my Ctrl + q short cut, then cells are yellow with my letter in them. If I select those same cells later and run the code then no color and no letter. then try: Sub CellColLetter() '/ Ctrl + q Dim rngC As Range For Each rngC In Selection rngC.Interior.ColorIndex = IIf(rngC.Interior.ColorIndex = xlNone, _ 6, xlNone) rngC = IIf(rngC = "", "A", "") Next End Sub Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sunday, April 26, 2015 at 9:20:40 AM UTC-7, Claus Busch wrote:
Hi Howard, Am Sun, 26 Apr 2015 09:14:41 -0700 (PDT) schrieb L. Howard: So if I select four cells and hit my Ctrl + q short cut, then cells are yellow with my letter in them. If I select those same cells later and run the code then no color and no letter. then try: Sub CellColLetter() '/ Ctrl + q Dim rngC As Range For Each rngC In Selection rngC.Interior.ColorIndex = IIf(rngC.Interior.ColorIndex = xlNone, _ 6, xlNone) rngC = IIf(rngC = "", "A", "") Next End Sub Regards Claus B. That does it, much cleaner than the With Selection. Thanks. Howard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF vs Boolean | Excel Discussion (Misc queries) | |||
Boolean Misread | Excel Programming | |||
More on Boolean | New Users to Excel | |||
SUMIF boolean? | Excel Worksheet Functions | |||
VBA Boolean | Excel Discussion (Misc queries) |