Excel VBA Get Range Reference To Last Row With Data

preview_player
Показать описание
How To Select The Last Row With Data

This tutorial shows you how to use vba to get a reference to an Excel Data Range and then iterate over each cell in that last row and apply custom formatting to it.




I use the following methods of the excel range object namely offset and resize to create multiple vba range objects.

Firstly I create an excel subroutine within that subroutine, three excel vba range objects are created, the first uses the currentregion method of the range object to referer to the excel data range, then I create a new range object by resizing that range to one row and refering to the top row of that spreadsheet range.

Finally a range reference is created to offset the first range reference by the number of rows in the data range less one in order to find the last row in the data table range.

Video Production
===============

Microphones
---------------

Video Kit
-------------
Lights

Note Taking
--------------

DISCLAIMER: This video and description contains affiliate links, this means if you click on one of the product links, I’ll receive a small commission.
Рекомендации по теме
Комментарии
Автор

Hello Sean, I am wondering if you can help me with the following task: I have two work books, the first one is to create invoice with customer information and purchasing details, the second workbook is to save dynamically the data including the invoice number, date, total price ..etc. extracted form the first workbook . At the end of the day I am going to save both workbooks and shut down the computer . what I would like to have the next day is when I open the first workbook, I want to open the second workbook using a command button on the first workbook, also I want to be able to get the last invoice number saved in the second workbook to be transferred to the first workbook with adding one to it . the invoice numbers are saved in column A2 :A in the second workbook. the invoice cell number is L11 in the first workbook .
I have created a command button on the first workbook to open the second workbook, that is successful, but I am not able to write the correct VBA code to transfer the last row cell value of column A from second workbook to the first workbook .
Can you please help me ?
thanks
Issam

issamalkhesho