I am trying to code a sub procedure that captures the first cell, first column and selects the data unto the last row, last column value. I would like to call and reference this sub in other sub procedures. I am looking for an effective coding method.
I have spent time with these two answers:
Sub SelectLastRow()
Dim nRow As Long, nColumn As Long
nRow = Cells(Rows.Count, "A").End(xlUp).Row
nColumn = Cells(nRow, Columns.Count).End(xlToLeft).Column
Range(Cells(nRow, "A"), Cells(nRow, nColumn)).Select
End Sub
I am interested in reversing the higher voted answer here: Excel VBA select range at last row and column
Here is a data set, I just want to capture the whole selection with headers.
Fail Count
2 90
1 58
Edit:
I just found this code as well, which does what I desire, what is the significance of .SpecialCells(xlCellTypeConstants, 23)
?
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("a1:G" & LR).SpecialCells(xlCellTypeConstants, 23).Select