VBA Finding the Last Populated Cell, Row, or Column in a WorksheetUsing VBA code for finding the last populated cell is simple. This can be accomplished by: Sub Last_Populated_Cell()Depending on what you are trying to accomplish, this cell may not be the cell that you are actually looking for. This is because, for example, if you type a value into cells A1,A2, and B1, Excel considers the last cell to be B2, which could have a value or not... The so called problem arises when you delete all the values in the last row or column. In the example, if we delete both the values in cell A2 and B1, the above code will still show that the last row is 2 and the last column is 2. Thus, if you added a value to a cell and deleted it, it is considered used as far as this formula goes. So, with VBA finding the last populated cell could look like this: Sub Last_Real_Populated_Cell()Note that what Excel calls the last populated cell may not actually be populated.
With VBA finding the last populated row with a value could be done like this: Sub Last_Real_Populated_Row()With VBA finding the last populated Column with a value could be done like this: Sub Last_Real_Populated_Column() This site is powered by Site Build It!. If you enjoy it, please check out the Site Build It homepage to learn more and on how to build a success-guaranteed site with no technical skills. Custom
Search
Return from vba finding the last populated to "VBA Code Samples"
|