Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Set Bkg Color if cell value is less than or equal to -14


Hi All,

I am trying to create a way to auto color a row if it meets a certai
criteria. The criteria is: IF the cell.value is Less than or equal t
-14 (i.e. -14, -15, -16, -17) Then color this row. Please help

The code I currently have is:

Private Sub Colour()
Dim LstFiltRow As Range
Dim LstFiltCol As Range
Dim R As Range

'Sheets(Var).Select
Range("A1").Select

Dim MyCheck

For Each R In Cells.Range("Q2:Q30")
MyCheck = R.Value = "-14"
If MyCheck = True Then
Cells.Rows(R.Row).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If

Next
Range("A1").Select
End Su

--
moglione
-----------------------------------------------------------------------
moglione1's Profile: http://www.excelforum.com/member.php...fo&userid=2641
View this thread: http://www.excelforum.com/showthread.php?threadid=53655

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Set Bkg Color if cell value is less than or equal to -14

Sub FormatRows()
Dim cel As Range
Dim rng As Range

Set rng = Range("Q2:Q30")

' remove previous formats ?
rng.EntireRow.Interior.ColorIndex = xlNone

For Each cel In rng
If cel.Value <= -14 Then
cel.EntireRow.Interior.ColorIndex = 6
End If
Next

End Sub

Regards,
Peter T

"moglione1" wrote
in message ...

Hi All,

I am trying to create a way to auto color a row if it meets a certain
criteria. The criteria is: IF the cell.value is Less than or equal to
-14 (i.e. -14, -15, -16, -17) Then color this row. Please help

The code I currently have is:

Private Sub Colour()
Dim LstFiltRow As Range
Dim LstFiltCol As Range
Dim R As Range

'Sheets(Var).Select
Range("A1").Select

Dim MyCheck

For Each R In Cells.Range("Q2:Q30")
MyCheck = R.Value = "-14"
If MyCheck = True Then
Cells.Rows(R.Row).Select
With Selection.Interior
ColorIndex = 6
Pattern = xlSolid
End With
End If

Next
Range("A1").Select
End Sub


--
moglione1
------------------------------------------------------------------------
moglione1's Profile:

http://www.excelforum.com/member.php...o&userid=26414
View this thread: http://www.excelforum.com/showthread...hreadid=536558



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
can I make cell "yes" equal 1, "no" equal 0 can I make cell yes equal 1, no equa Excel Discussion (Misc queries) 4 April 22nd 23 06:09 AM
Need cell color to equal text Skeetra27 Excel Discussion (Misc queries) 8 July 28th 09 05:09 PM
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
If data added to Excel cell it automatically make's another cell equal zero [email protected] Excel Programming 1 October 19th 05 06:00 PM
lower and upper case equal on spreadsheet but not equal in VB don Excel Programming 2 March 13th 05 12:04 AM


All times are GMT +1. The time now is 10:52 PM.

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"