From: JMay on 16 Mar 2010 15:13 Thanks Gary;;; "Gary Brown" wrote: > 1) create a Module in the Visual Basic Editor (VBE) > - INSERT > MODULE > > 2) put the following line of code at the top of the module in order to make > it's SCOPE so that all modules will know it's value... > Public Lrow As Long > > 3) in the 'ThisWorkbook' module, put the following code... > Private Sub Workbook_Open() > Lrow = Worksheets("Sheet2").Cells.SpecialCells(xlLastCell).Row > End Sub > > 4) in the worksheet "Sheets2" module, put the following code... > Private Sub Worksheet_Change(ByVal Target As Range) > Lrow = Worksheets("Sheet2").Cells.SpecialCells(xlLastCell).Row > End Sub > > -- > Hope this helps. > If it does, please click the Yes button. > Thanks in advance for your feedback. > Gary Brown > > > > "JMay" wrote: > > > I need to capture the Last Row number as soon as the WB opens; And as the > > sheet2 Column A cells are filled-in have the variable Lrow furnish an > > up-to-date > > value, representing the last non-blank row in Col A of Sheet2. The below is > > not working; Can yo suggest a better way? > > > > TIA, > > > > Dim Lrow As Long > > Private Sub Workbook_Open() > > Lrow = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row > > End Sub |