Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, i am able to change every other line color but i need to do it a
bit differently with VBA. For every new number in column "A" i need to alternate yellow and no color. see example below. gAMS No gAMS Description AAB05U HA-Getriebe--- Yellow AAB05U HA-Getriebe--- Yellow AAF15U BlowBy-Einleitung in Luftfuehrung N54--- White AAJ28U Getriebeoelkuehlerruecklaufleitung---Yellow AAK45U Getriebekabelbaum N46 OL RL--- White AAK78U Schalthebeltilger PL-2 M47---Yellow AAW81T QUAKO AFS Lenkhilfekuehler PL2--- White AEX31U QUAKO- Kopfsstuetze PL2 Leder ohne Watte--- Yellow AEX31U QUAKO- Kopfsstuetze PL2 Leder ohne Watte--- Yellow AEY08U Quako: Cost Down Massnahme Radio Stufe 1---White Any assistance with code would be appreciated... Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
not saying this is the best way, but seems to work with your data. i just copied
what you posted and pasted it in A1 and replicated some down to A20. someone may have a simpler solution. Sub test() Dim cell As Range Dim cntr As Long cntr = 0 For Each cell In Range("a2:A20") If cell.Value = cell.Offset(-1, 0).Value Then If cntr Mod 2 = 1 Then cell.Offset(-1, 0).Interior.ColorIndex = 6 Else cell.Offset(-1, 0).Interior.ColorIndex = 2 End If Else cntr = 1 + cntr If cntr Mod 2 = 1 Then cell.Offset(-1, 0).Interior.ColorIndex = 2 Else cell.Offset(-1, 0).Interior.ColorIndex = 6 End If End If nxt: Next End Sub -- Gary "Les Stout" wrote in message ... Hi all, i am able to change every other line color but i need to do it a bit differently with VBA. For every new number in column "A" i need to alternate yellow and no color. see example below. gAMS No gAMS Description AAB05U HA-Getriebe--- Yellow AAB05U HA-Getriebe--- Yellow AAF15U BlowBy-Einleitung in Luftfuehrung N54--- White AAJ28U Getriebeoelkuehlerruecklaufleitung---Yellow AAK45U Getriebekabelbaum N46 OL RL--- White AAK78U Schalthebeltilger PL-2 M47---Yellow AAW81T QUAKO AFS Lenkhilfekuehler PL2--- White AEX31U QUAKO- Kopfsstuetze PL2 Leder ohne Watte--- Yellow AEX31U QUAKO- Kopfsstuetze PL2 Leder ohne Watte--- Yellow AEY08U Quako: Cost Down Massnahme Radio Stufe 1---White Any assistance with code would be appreciated... Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change the colour of numbers in a cell if the number is negative | Excel Worksheet Functions | |||
Change text colour according to number | Excel Worksheet Functions | |||
How do i format cell to change colour as the number increases | Excel Programming | |||
change cell colour if value in column = x?? | Excel Programming | |||
Change cell Colour when a number of days have been passed | Excel Discussion (Misc queries) |