Try This

 

Sub GiveColor()

Dim rng As Range

Dim cell As Range

Set rng = Range("B2:B" & ActiveSheet.UsedRange.Rows.Count)

 

For Each cell In rng

If cell.Value < 0 Then

cell.Offset(0, -1).Resize(1, 2).Interior.ColorIndex = 38

End If

Next

End Sub

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Jorge Marques
Sent: Wednesday, July 13, 2011 4:05 PM
To: excel-macros@googlegroups.com
Subject: Re: $$Excel-Macros$$ HELP urgent

 

Hi friend, i don´t understand exactly what you want, but if you want to
highlight the entire row that has the negative numbers like this, or do you
want it to copy to another column the year and negative value?

 


Year

Cash Available


2002

0


1983

6.71


1995

23.75


1994

21.06


2007

-11


2009

20


2011

29.66


2008

-11


1989

17.01


2005

15.02


2001

-20


1990

21.06


2008

17.01

Is this what you what?

 

I´m new at this, but i made this code, maybe not very programming accurate,
but the best i did :S

 

"Sub Colorize()
ActiveSheet.Cells.Interior.ColorIndex = xlNone
For Each Cell In ActiveSheet.UsedRange
If Cell.Value < 0 Then
Cell.Offset(0, -1).Interior.ColorIndex = 38
End If
Next
For Each Cell In ActiveSheet.UsedRange
If Cell.Value < 0 Then
Cell.Offset(0, 0).Interior.ColorIndex = 38
End If
Next
End Sub"

2011/7/13 Rajan_Verma <rajanverma1...@gmail.com>

Please attach a sample file with more explaination..

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Puneet Jain
Sent: Wednesday, July 13, 2011 12:45 PM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ HELP urgent

 

 

Guys

 

Need Help. 

 

In the series of cash flows, if at anytime the negative falue appears. a
cell should indicate that negative value along-with the corresponding year
in which that negative value appears.




Cash Available


 


0.00


6.71


23.75


21.06


17.01


20.00


29.66


21.06


17.01


15.02


24.67


21.06


17.01


Regards

 

Puneet 

9899068873

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
<http://www.excel-macros.blogspot.com/> 
4. Learn VBA Macros at http://www.quickvba.blogspot.com
<http://www.quickvba.blogspot.com/> 
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
<http://exceldailytip.blogspot.com/> 

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
<http://www.excel-macros.blogspot.com/> 
4. Learn VBA Macros at http://www.quickvba.blogspot.com
<http://www.quickvba.blogspot.com/> 
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
<http://exceldailytip.blogspot.com/> 

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

 

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to