Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Performing Action On Multiple Values In A Column

I am currently working with a list of test numbers that are stored in column
A. I need the rows to be highlighted red if there is a particular test
number in column A. I couple of days ago, there was a forumala that came
across that works great for 1 value. However, I need to be able to specify
around 10 test numbers. I have tried declaring variables with Dim,
modifying the formula below, etc. I can't seem to get anything to work.
Anyone have any ideas?

Cells.Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$H1=""JOHN SMITH"""
Selection.FormatConditions(1).Interior.ColorIndex = 3
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Performing Action On Multiple Values In A Column

If you are looking for numbers, then check out the Choose formula. You
would have to modify the first argument to an expression to return a whole
number in the range 1 to 29 for the conditions you want to mark

Range("F1:F200").Select
Range("F1").Activate
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=CHOOSE(F1,TRUE,,,,,,TRUE,,,,,,TRUE,,,,,TRUE) "
Selection.FormatConditions(1).Interior.ColorIndex = 36

There may be alternatives, but more specific details would be needed.

--
Regards,
Tom Ogilvy


"Computer Lady" wrote in message
. ..
I am currently working with a list of test numbers that are stored in

column
A. I need the rows to be highlighted red if there is a particular test
number in column A. I couple of days ago, there was a forumala that came
across that works great for 1 value. However, I need to be able to

specify
around 10 test numbers. I have tried declaring variables with Dim,
modifying the formula below, etc. I can't seem to get anything to work.
Anyone have any ideas?

Cells.Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$H1=""JOHN SMITH"""
Selection.FormatConditions(1).Interior.ColorIndex = 3



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Performing Action On Multiple Values In A Column

Hello, Tom. Thank you for the suggestion. I inserted the values (test
numbers) and I am getting a syntax error and it will not compile. Some
additional information on what I am looking for........I have a list of test
numbers that go down column A. In column B, it is the test description and
in column C it is the number of tests. There are certain test numbers that
need to be flagged because they should no longer be utilized. The user has
requested that the entire row be highlighted in red if the test number in
column A is equal to 0032598, 0078945, 0014792, 0034789, 0099874, and
0037941. Any additional ideas?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Performing Action On Multiple Values In A Column

Sub AddConditional()
Set rng = Range("A1").CurrentRegion.Resize(, 3)
ThisWorkbook.Names.Add Name:="List1", RefersTo:= _
"={""0032598"",""0078945"",""0014792""," & _
"""0034789"",""0099874"",""0037941""}"
rng.Select
rng(1).Activate
sStr = rng(1).Address(0, 1)
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=NOT(ISERROR(MATCH(" & sStr & ",List1,0)))"
Selection.FormatConditions(1).Interior.ColorIndex = 3
End Sub

Worked for me.

My test numbers were stored as text.

--
Regards,
Tom Ogilvy


"Computer Lady" wrote in message
. ..
Hello, Tom. Thank you for the suggestion. I inserted the values (test
numbers) and I am getting a syntax error and it will not compile. Some
additional information on what I am looking for........I have a list of

test
numbers that go down column A. In column B, it is the test description

and
in column C it is the number of tests. There are certain test numbers

that
need to be flagged because they should no longer be utilized. The user

has
requested that the entire row be highlighted in red if the test number in
column A is equal to 0032598, 0078945, 0014792, 0034789, 0099874, and
0037941. Any additional ideas?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Performing Action On Multiple Values In A Column

Your amazing! It worked great. Thanks for your help.
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
Performing Action on a Range of Rows JohnB[_2_] Excel Discussion (Misc queries) 1 July 20th 07 01:48 AM
Performing Action on a Range of Rows JohnB[_2_] Excel Discussion (Misc queries) 2 July 19th 07 06:22 PM
Performing Multiple Functions in a Column dhoward via OfficeKB.com Excel Worksheet Functions 2 June 23rd 06 04:25 PM
Performing a multiple column lookup JDay Excel Discussion (Misc queries) 1 December 1st 05 08:34 PM
Searching for a string and then performing an action if present matpj[_24_] Excel Programming 1 November 23rd 05 11:22 AM


All times are GMT +1. The time now is 12:43 AM.

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

About Us

"It's about Microsoft Excel"