Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i want to know if there is any solution for this query.
i want vba code to compare values of 2 column. and if value of column 1 is higher than that in second value in col one should turn red. if it is lower than it should turn green & if it is equal then it should turn blue. Thanking in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can do this using conditional formatting: no code required.
Tim "Jimish" wrote in message ups.com... i want to know if there is any solution for this query. i want vba code to compare values of 2 column. and if value of column 1 is higher than that in second value in col one should turn red. if it is lower than it should turn green & if it is equal then it should turn blue. Thanking in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
yes this is usefull if it is only for one set of col. but if it is for
20 to 25 sets of col. each having 40 to 50 items then it is tough so if there is any solution for this in vba then it is usefull |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can you restate your problem? Reading your original post it's not really
clear what you need to do, since you only reference column1. Are you comparing values across two different columns on the same row? Where do values start and end? Should color only change in the first column? Are the columns next to each other? tim -- Tim Williams Palo Alto, CA "Jimish" wrote in message ups.com... yes this is usefull if it is only for one set of col. but if it is for 20 to 25 sets of col. each having 40 to 50 items then it is tough so if there is any solution for this in vba then it is usefull |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i am giving u an example here
A1 value is 230 and B1 value is 225 hence i want value in cell A1 to turn red as it is higher. this is easy to do with conditional formatting option but it is rather harder and time consuming if it is to be repeated for A1 : A55 and upto Z1 : Z55. So i wanted to know whether there is any solution for that available in vba code. And thanks for taking out time for my query. And thanks again in advance for the hopefull solution |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
and i would also like to know whether it is possible to compare 2 col.
of diffrent sheet and give conditional formating the same way as it is in the above case. pls give solutions for both diffrently.Tankis once again. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bearing in mind that you can apply conditional formatting to an entire
column at once I agree that this is the easiest solution. If you really didn't want to do it manually you could use a macro to add the conditional formatting. It is still unclear if you want to compare column A to B, B to C, C to D etc or A to B, C to D, E to F etc. If the former then you the macro would look something like this; Sub Frmt() Dim eRow As Long Dim eCol As Integer Dim c As Integer eCol = Cells(1, Columns.Count).End(xlToLeft).Column - 1 eRow = Cells(Rows.Count, 1).End(xlUp).Row For c = 1 To eCol With Range(Cells(1, c), Cells(eRow, c)) .Cells(1, c).Activate .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression _ , Formula1:="=RCRC[1]" .FormatConditions(1).Font.ColorIndex = 3 .FormatConditions.Add Type:=xlExpression _ , Formula1:="=RC<RC[1]" .FormatConditions(2).Font.ColorIndex = 10 .FormatConditions.Add Type:=xlExpression _ , Formula1:="=RC=RC[1]" .FormatConditions(3).Font.ColorIndex = 5 End With Next c End Sub Hope this helps Rowan Jimish wrote: i am giving u an example here A1 value is 230 and B1 value is 225 hence i want value in cell A1 to turn red as it is higher. this is easy to do with conditional formatting option but it is rather harder and time consuming if it is to be repeated for A1 : A55 and upto Z1 : Z55. So i wanted to know whether there is any solution for that available in vba code. And thanks for taking out time for my query. And thanks again in advance for the hopefull solution |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Match data then comapre and return new data | Excel Worksheet Functions | |||
Macro for comapre and copy | Excel Discussion (Misc queries) | |||
comapre two list of data & arranging in a same manner | New Users to Excel | |||
comapre two lists | Excel Discussion (Misc queries) | |||
How do i comapre 2 columns | Excel Programming |