Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Format row based on cell value

Linc,

I left in the commented out section to show what I was working with
before. The new code is working great. The varible in the begining of
'y' has to be manually edited and I would like to find a way for it to
be automatic or for it to pull it from a cell where maybe I can put a
number. This way I wouldn't have to edit the Vba script everytime I add
rows to the document


Typically, the way to do that is to find the bottom cell by using an End-Up
combination:

For y = 4 To Cells(65536, 10).End(xlUp).Row

HTH,
Bernie
MS Excel MVP


"Linc" wrote in message
...

Oh how cool ! I am very excited. With your help I figure out a few
things and well, used part of your code to get to the following and I
am very happy. Not done with this yet but this part is working great.

<SNIP CODE
Private Sub Worksheet_Calculate()

Application.ScreenUpdating = False

For y = 4 To 38
Cells(y, 10).Select
A_Done = Cells(y, 10)
Dim ActiveRow As Long
ActiveRow = ActiveCell.Row
If ActiveCell.Value = "x" Then
Range(Cells(ActiveRow, 1), Cells(ActiveRow, 8)).Interior.ColorIndex
= 4
End If
If ActiveCell.Value = "x1" Then
Range(Cells(ActiveRow, 1), Cells(ActiveRow, 8)).Interior.ColorIndex
= 4
End If
If ActiveCell.Value = "x2" Then
Range(Cells(ActiveRow, 1), Cells(ActiveRow, 8)).Interior.ColorIndex
= 4
End If
If ActiveCell.Value = "x3" Then
Cells(ActiveRow, 1).Interior.ColorIndex = 4
Cells(ActiveRow, 2).Interior.ColorIndex = 4
Range(Cells(ActiveRow, 5), Cells(ActiveRow, 8)).Interior.ColorIndex
= 4
End If
If ActiveCell.Value = "x4" Then
Cells(ActiveRow, 1).Interior.ColorIndex = 4
Cells(ActiveRow, 3).Interior.ColorIndex = 4
Cells(ActiveRow, 8).Interior.ColorIndex = 4
End If
If ActiveCell.Value = "o" Then
Range(Cells(ActiveRow, 1), Cells(ActiveRow, 8)).Interior.ColorIndex
= 0
End If
If ActiveCell.Value = "o1" Then
Range(Cells(ActiveRow, 1), Cells(ActiveRow, 8)).Interior.ColorIndex
= 0
End If
If ActiveCell.Value = "o2" Then
Range(Cells(ActiveRow, 1), Cells(ActiveRow, 8)).Interior.ColorIndex
= 0
End If
If ActiveCell.Value = "o3" Then
Cells(ActiveRow, 1).Interior.ColorIndex = 0
Cells(ActiveRow, 2).Interior.ColorIndex = 0
Range(Cells(ActiveRow, 5), Cells(ActiveRow, 8)).Interior.ColorIndex
= 0
End If
If ActiveCell.Value = "o4" Then
Cells(ActiveRow, 1).Interior.ColorIndex = 0
Cells(ActiveRow, 3).Interior.ColorIndex = 0
Cells(ActiveRow, 8).Interior.ColorIndex = 0
End If
' If A_Done = "x" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
' ActiveCell.Select
' With Selection
' .Interior.ColorIndex = 4
' .Interior.Pattern = xlSolid
' .Font.ColorIndex = 4
' End With
' ElseIf A_Done = "o" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
' ActiveCell.Select
' With Selection
' .Interior.ColorIndex = 0
' .Interior.Pattern = xlSolid
' .Font.ColorIndex = 2
' End With
' End If
Next y

Application.ScreenUpdating = True

End Sub

<END CODE SNIP

I left in the commented out section to show what I was working with
before. The new code is working great. The varible in the begining of
'y' has to be manually edited and I would like to find a way for it to
be automatic or for it to pull it from a cell where maybe I can put a
number. This way I wouldn't have to edit the Vba script everytime I add
rows to the document.

Thanks million - I am really enjoying this stuff.

Linc

P.S. Question - I click the box for 'email notification' when I post
but I never get an email to tell me there was a reply.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
Conditiona format based on format of another cell Tami Excel Worksheet Functions 1 December 18th 09 04:48 AM
Format cell color based on multiple cell values Zenaida Excel Discussion (Misc queries) 1 May 10th 06 07:31 PM
Format cell color based on multiple cell values Zenaida Excel Discussion (Misc queries) 3 May 9th 06 11:56 PM
conditional cell format based on cell in same row, previous column tamiluchi Excel Worksheet Functions 7 May 3rd 06 04:11 PM
how do i format a cell based on format of a range of cells? Chris Hardick Excel Discussion (Misc queries) 2 April 3rd 06 08:54 AM


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