Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
J-D J-D is offline
external usenet poster
 
Posts: 1
Default VBA - Coloring Rows Instead of Cells

Please Help!

I'm using the following in VBA:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

It change the color in that cell but I want it to color the row from coulums
A to N? Can somebody show me how to do that?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default VBA - Coloring Rows Instead of Cells

Simply add a loop using the targets row property:


For myloop = 1 To 14
ActiveSheet.Cells(Target.Row, myloop).Interior.ColorIndex = icolor
Next




"J-D" wrote:

Please Help!

I'm using the following in VBA:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

It change the color in that cell but I want it to color the row from coulums
A to N? Can somebody show me how to do that?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default VBA - Coloring Rows Instead of Cells

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Stop
Target.EntireRow.Interior.ColorIndex = icolor
End If

End Sub


"J-D" wrote in message
...
Please Help!

I'm using the following in VBA:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

It change the color in that cell but I want it to color the row from
coulums
A to N? Can somebody show me how to do that?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default VBA - Coloring Rows Instead of Cells

Excellent! Thank you Dom_Ciccone.

"Dom_Ciccone" wrote:

Simply add a loop using the targets row property:


For myloop = 1 To 14
ActiveSheet.Cells(Target.Row, myloop).Interior.ColorIndex = icolor
Next




"J-D" wrote:

Please Help!

I'm using the following in VBA:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

It change the color in that cell but I want it to color the row from coulums
A to N? Can somebody show me how to do that?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default VBA - Coloring Rows Instead of Cells

Oops! "Stop" should not have been left in the code.

"PCLIVE" wrote in message
...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Stop
Target.EntireRow.Interior.ColorIndex = icolor
End If

End Sub


"J-D" wrote in message
...
Please Help!

I'm using the following in VBA:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A6:n2000")) Is Nothing Then
Select Case Target
Case 15
icolor = 4
Case -15
icolor = 46
Case 100
icolor = 6
Case -100
icolor = 3
Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

It change the color in that cell but I want it to color the row from
coulums
A to N? Can somebody show me how to do that?





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
Coloring rows of cells [email protected] Excel Discussion (Misc queries) 2 June 1st 06 02:24 PM
Coloring rows in excel Kjetil Excel Worksheet Functions 5 December 10th 05 02:37 PM
COLORING IN CELLS jim mcgrath Excel Discussion (Misc queries) 4 November 24th 05 04:31 PM
coloring in rows koba Excel Discussion (Misc queries) 9 November 10th 05 05:57 AM
Coloring certain cells Tim Excel Worksheet Functions 2 September 5th 05 04:01 AM


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