OK Thanks for your reply. I just had a glimpse on your code. Now let me explain my requirements.
I would like to set the number of LEDs to turn on at a particular length. For eg. I want to turn on just 3 LEDs in Red starting from 20. That is LEDs 20,21&22 should turn on. Like wise I will change the position and number. How can I code it?