I'm fighting to understand VBA; Boy is it fun or what :)...
[FONT="System"][COLOR="Blue"]BTW, I sense that if I have a solid understanding of the Excel object model, learning and using VBA would become much easier. Is this correct? Can you kindly share some good URLs which can help? Hope you'll help and guide.[/COLOR][/FONT]
Now coming to the question:
I have copied a piece of code and am trying to understand how it work. The scenario is that the following values are in Column A (starting with cell A1) i.e. A1 contains the value 81 and A5 contains the value 124:
I can't understanding the working of the following line of code:
Here's my understanding:
- The focus is moved to the last row of Column #1 in Sheet1. This is achieved by
- Then the focus moves up to the first cell that contains any value. This is achieved by
I was expecting that after execution of the above code, iRow it will hold the value 124 (which are the contents of the 1st row that is encountered when the code executes ".End(XlUp).Row"). However the debug window shows that iRow contains the value 5??? Seems like that contrary to my understanding, iRow is holding a pointer to A5??
I hope this is not a (too) naive post and advance thanks not only for your reply but more importantly for guiding me in the right direction which will help me get very comfortable using VBA.