
There are many, many more examples of this and I'm am sure you can think of a few examples yourself. There are a ton of things you can do with calculating the last row or last column of a data set. What Can I Do With A LastRow Or LastColumn Variable? The below figure illustrates the difference. What I mean by a " well-formatted data sheet", is a worksheet with data that starts in cell A1 and does not have any blank rows or columns in the middle of the data. Keep in mind, some of these methods may not give you the desired row or column number if you are not setting them up properly or using a well-formatted data sheet. Below I have compiled a list of all the major ways I have Use Caution!
#VISUAL BASIC EXCEL CODE#
I have found that writing VBA code that can automatically resize itself is one of the greatest things missing from most average macro users. Variability is also the greatest challenge for any computer coder as you have to think of every possible change that could occur in the future. I soon came to realize the goal of coding a macro: to write it once and never touch it again. My coding skills dramatically changed the day I realized my VBA code could be dynamic and automatically determine the size of my raw data once executed. I had created a bunch of macros to cleanup and perform analysis on raw data exported from database warehouses and the data never had the same amount of rows from one data-pull to the other. Early on when I was first beginning to write VBA macro code, I always needed to go back into the code and modify range references.
