LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Private sub worksheet_change(bval target as range) issue

Hi There,

I have a macro that changes the color of the cell "g4" as the cell changes
numerical values in this code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("g4"), Target) Is Nothing Then
If Range("g4").Value 0 Then
Range("g4").Cells.Interior.ColorIndex = 35
ElseIf Range("g4").Value < 0 Then
Range("g4").Cells.Interior.ColorIndex = 38
Else
Range("g4").Cells.Interior.ColorIndex = xlNone
End If
End If
End Sub

I would like to make it so that the color changes as cell values change for
each cell from "g4" to "g16"

I figure I can copy and paste this code in the private sub and then adjust
the cell reference, but I imagine there is a much more simple and efficient
method that I can't think of.

Thanks for your help
 
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
Control Toolbox and Private Sub Worksheet_Change(ByVal Target As R [email protected] Excel Discussion (Misc queries) 1 August 17th 07 09:38 AM
Control Toolbox and Private Sub Worksheet_Change(ByVal Target As R Toppers Excel Discussion (Misc queries) 0 August 17th 07 02:02 AM
Private Sub Worksheet_Change(ByVal Target As Excel.Range) Arturo Excel Programming 5 March 9th 07 04:30 PM
Private Sub Worksheet_Change(ByVal Target As Excel.Range) [email protected] Excel Worksheet Functions 0 December 21st 06 02:13 AM
Private Sub Worksheet_Change(ByVal Target As Range) Arturo Excel Programming 1 May 25th 05 03:32 PM


All times are GMT +1. The time now is 05:02 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"