Hello

I presume that you will paste data to this sheet. If yes I would use 
separate macro for colouring cells using loop above selected range (this 
macro can be called using event procedure worksheet_change as belowe- not 
tested). 

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Call my_macro(target)
End sub

Private SUB my_macro(MYRNG as range)

MYRNG As Range
for each c in MYRNG.cells

If c.Interior.ColorIndex = xlNone And c.Value <> "" Then
    c.Interior.ColorIndex = 4
    
    ElseIf c.Interior.ColorIndex = 4 And c.Value <> "" Then
    Target.Interior.ColorIndex = 6
        
        ElseIf c.Interior.ColorIndex = 6 And c.Value <> "" Then
    c.Interior.ColorIndex = 3
        
        End If
Next
End Sub



Or simpler method is conditional formating.
W dniu czwartek, 5 maja 2016 09:32:10 UTC+2 użytkownik suman kumar napisał:
>
> Dear Team,
>
> I'm using below code to change the cell color once value entered but I'm 
> unable to use this for MYRNG.  I tried to do this with For Each Loop but 
> with this loop code is changing the entire MYRNG’s color.
> Can someone please help me out to resolve this issue? After correction 
> please also help to calculate the % of Color also in next column.
>
>       
>     
>
> *Suman Kumar*
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to