Another method to extract the last row containing data in a column

0 votes

I now use this code to find the last row of data in Sheet1's column A.

lrow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row

The issue is that, whenever I use this in a table that Excel has retrieved from a database, it always selects the very last row as "lrow," even if that row has no data.

When I first encountered this problem, which was a very long time ago, I learned that there was another method to design the code for finding lrow in a way that made it effective for tables that came from databases and were connected to data connections. I've been hunting for it today, but I can't seem to find it.

Mar 28, 2023 in Others by narikkadan
• 63,600 points
610 views

1 answer to this question.

0 votes
The "used range" might not be accurate. Any cell that has ever been used, that is, had data but then had the data removed, is included in the used range.

If you want to recalculate the used ranges, try running something similar to this before your function.
answered Mar 28, 2023 by Kithuzzz
• 38,000 points

Related Questions In Others

0 votes
1 answer

How to find the last row in a column using openpyxl normal workbook?

ws.max_row will give you the number of rows ...READ MORE

answered Dec 25, 2022 in Others by narikkadan
• 63,600 points
6,639 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

In excel how do I reference the current row but a specific column?

Put a $ symbol in front of ...READ MORE

answered Oct 15, 2022 in Others by narikkadan
• 63,600 points
1,966 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
1,260 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
3,697 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
978 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
1,090 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP