Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default A Boolean expression




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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default A Boolean expression

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default A Boolean expression

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default A Boolean expression

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default A Boolean expression

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default A Boolean expression

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default A Boolean expression

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF vs Boolean Brad Excel Discussion (Misc queries) 3 September 4th 09 01:58 AM
Boolean Misread ben Excel Programming 6 February 13th 07 08:10 PM
More on Boolean Epinn New Users to Excel 7 November 28th 06 09:29 AM
SUMIF boolean? Daminc Excel Worksheet Functions 12 May 4th 06 05:21 PM
VBA Boolean Jeff Excel Discussion (Misc queries) 1 February 2nd 06 10:01 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"