I have tried to just set the range to ("A:A") but that makes the table too large and my computer freezes up, I have also tried to input a line like Range("A" & Rows.Count).End(xlUp).Offset(1)
but that is not recognized by VBA.
Any help would be appreciated!
Asked
Active
Viewed 183 times
0

Excelnoob
- 17
- 7
-
3https://stackoverflow.com/questions/38882321/better-way-to-find-last-used-row `Range("A1:A" & LastRow).Select` – braX Dec 13 '22 at 20:13
-
yeah, unfortunately that didn't work. – Excelnoob Dec 13 '22 at 20:34
-
@Excelnoob what exactly didn't work? – Cyril Dec 13 '22 at 21:00
-
Sorry, my bad, new to the forum, I keep forgetting that a generic answer won't help solve a problem. Range("A1:A" & LastRow).Select did not work. – Excelnoob Dec 13 '22 at 21:08
-
1You need to follow the link attached to @braX 's comment – Cameron Critchlow Dec 13 '22 at 21:15
-
1Does this answer your question? [Better way to find last used row](https://stackoverflow.com/questions/38882321/better-way-to-find-last-used-row) – braX Dec 13 '22 at 21:17
-
@Cameron Critchlow's code below worked like an absolute charm! Thanks so much guys! – Excelnoob Dec 13 '22 at 21:38
1 Answers
1
You need to first define your last row by referencing the last cell in the column then use .End(xlUp).row
to find the last row number. You can then use that row number to build cell references, or even save the range as a range variable like I did:
Sub Last_Row_Example()
Dim LastRow As Long 'Last Row as a long integer
Dim RG As Range 'A range we can reference again and again very easily
'Consider renaming it to something more descriptive.
'for your particular situation
LastRow = Range("A" & Rows.Count).End(xlUp).Row ' Here we store the "LastRow" Number
Set RG = Range("A1:A" & LastRow) ' Here we build a range using the LastRow variable.
RG.Select
Application.CutCopyMode = False
ActiveSheet.ListObjects.Add(xlSrcRange, RG, , xlYes).Name = _
"Table3"
Range("Table3[[#All],[Ticker Name]]").Select
Selection.ConvertToLinkedDataType ServiceID:=268435456, LanguageCulture:= _
"en-US"
End Sub

Cameron Critchlow
- 1,814
- 1
- 4
- 14