Which do you think is better the DO While or the FOR loop. Yes I will be increasing by 1 everytime the code gets to the bottom of the row.
I would slightly prefer the For loop in that case (because it is designed for that circumstance). For one thing, it is easy to forget to increment the loop counter in a Do loop and you end up with an endless loop.
I'm sure there is a reason why there is a TO there but I don't know why.
xlLeft is a constant (-4131) used to select a left-hand position for things (a chart legend, a summary column or, in earlier versions, a left-hand border). xlToLeft is a constant (-4159) used with End to mean a direction of travel and with Delete to indicate a shift direction.
I guess the people who chose those values about 18 years ago didn't think that they were sufficiently similar that using the same name (and therefore constant value) was appropriate, and from the numbers I would think that the programmer who defined xlLeft got there first.
Bill Manville Excel MVP/TA Oxford, England
Edited Nov-6 by Bill Manville |