Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
bodhisatvaofboogie
 
Posts: n/a
Default If Statements Question

I am working on some macros to automate some organization of data for parts
inventory management purposes, and reporting. I wanted to have certain rows
get highlighted automatically when the data is all imported and it meets
certain criteria. FOR INSTANCE:

If COLUMN D is greater than 3, bold the entire ROW with X coloring. What is
the most efficient method for this? Perhaps even step it out further and put
in ranges to bold different collors instead of just a blanket greater than
(ie: between 3 and 6 bold X color, between 7 and 10 bold X color, etc. )
  #2   Report Post  
Posted to microsoft.public.excel.misc
macropod
 
Posts: n/a
Default If Statements Question

Hi,

If you only need four colours, including the default one, conditional
formatting might fulfil your needs, without resorting to vba.

For more than four colours, a vba solution is fairly straightforward. For
example, putting the following code in the Worksheet will automatically
change the colours as the values in Column D change:

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column = 4 Then
Select Case .Value
Case 0 To 2.99
.EntireRow.Interior.ColorIndex = 4
Case 3 To 5.99
.EntireRow.Interior.ColorIndex = 6
Case 6 To 9.99
.EntireRow.Interior.ColorIndex = 39
Case 10 To 14.99
.EntireRow.Interior.ColorIndex = 41
Case Is = 15
.EntireRow.Interior.ColorIndex = 3
Case Else
.EntireRow.Interior.ColorIndex = 0
End Select
End If
End With
End Sub

Six csaes are catered for; add or delete as needed.

Cheers


"bodhisatvaofboogie" wrote in
message ...
I am working on some macros to automate some organization of data for

parts
inventory management purposes, and reporting. I wanted to have certain

rows
get highlighted automatically when the data is all imported and it meets
certain criteria. FOR INSTANCE:

If COLUMN D is greater than 3, bold the entire ROW with X coloring. What

is
the most efficient method for this? Perhaps even step it out further and

put
in ranges to bold different collors instead of just a blanket greater than
(ie: between 3 and 6 bold X color, between 7 and 10 bold X color, etc. )



  #3   Report Post  
Posted to microsoft.public.excel.misc
bodhisatvaofboogie
 
Posts: n/a
Default If Statements Question

Thanks for that :)

"macropod" wrote:

Hi,

If you only need four colours, including the default one, conditional
formatting might fulfil your needs, without resorting to vba.

For more than four colours, a vba solution is fairly straightforward. For
example, putting the following code in the Worksheet will automatically
change the colours as the values in Column D change:

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column = 4 Then
Select Case .Value
Case 0 To 2.99
.EntireRow.Interior.ColorIndex = 4
Case 3 To 5.99
.EntireRow.Interior.ColorIndex = 6
Case 6 To 9.99
.EntireRow.Interior.ColorIndex = 39
Case 10 To 14.99
.EntireRow.Interior.ColorIndex = 41
Case Is = 15
.EntireRow.Interior.ColorIndex = 3
Case Else
.EntireRow.Interior.ColorIndex = 0
End Select
End If
End With
End Sub

Six csaes are catered for; add or delete as needed.

Cheers


"bodhisatvaofboogie" wrote in
message ...
I am working on some macros to automate some organization of data for

parts
inventory management purposes, and reporting. I wanted to have certain

rows
get highlighted automatically when the data is all imported and it meets
certain criteria. FOR INSTANCE:

If COLUMN D is greater than 3, bold the entire ROW with X coloring. What

is
the most efficient method for this? Perhaps even step it out further and

put
in ranges to bold different collors instead of just a blanket greater than
(ie: between 3 and 6 bold X color, between 7 and 10 bold X color, etc. )




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
Pivot table question gary Excel Discussion (Misc queries) 1 January 10th 06 06:25 PM
Linking two IF statements together trixma Excel Discussion (Misc queries) 2 September 29th 05 06:07 AM
How do I find and replace a question mark in Excel? Ranpalandil Excel Discussion (Misc queries) 1 September 7th 05 10:20 PM
Another question concerning IF statements Jessica Excel Discussion (Misc queries) 1 July 14th 05 06:56 PM
Question concerning IF statements Jessica Excel Discussion (Misc queries) 1 July 14th 05 06:50 PM


All times are GMT +1. The time now is 02:55 PM.

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"