Ok thanks everyone for valuable inputs. But i have figured out the answer to my question. It lies in the algorithm used for scanning.
The algorithm which I was using (as i have quoted above too) lights up ONLY & ONLY 1 LED at a time (for some microseconds), then turns it off and turns on the next one. so in this case I need to calculate the resistance according to just 1 led. in my case, using 5V supply from Arduino Pins, 2V drop across LED, 20mA current rating, R comes out to be exactly 150 ohms.
The disadvantage might be somewhat dimmer LEDs as compared to the other method, but it is compensated by the fact that we can provide 20mA of current to the LED instead of X ( X= 40mA / No. of LEDs per row ).
The other method off course comprises lighting up all LEDs in a single row or column at a time, delay of some microseconds, then turning them all off and moving to the next row/column. So we have to limit the current to X as Arduino cannot provide greater than 40mA per pin. I believe in case of a 8x8 or 9x9 matrix, I will have even dimmer LEDs using this technique as compared to the 1st one.
Similarly, there can be a case where multiple rows/columns can also be turned on at same time. (depends on the type of image you want to display.) In that case one has to consider not only 40mA per pin constraint but also the 200mA constraint for all pins considered collectively.
The 1st algo is the best one for my needs. As it can display ANY image with good brightness levels.
Experts can rectify if there is anything wrong in my theory.