ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   find last row with data in it (https://www.excelbanter.com/excel-discussion-misc-queries/14764-find-last-row-data.html)

johnb

find last row with data in it
 
Hi all,

I have ssheet thats an daily output from a SAP system and
data is all over the place with many empty columns and
rows. The number of rows change daily and range from a
few hundred to 65000. I current use a For Next loop to
search to whole ssheet and its works fine. But
having "For 1 to 65536" seems a bit crude when there is
only a few hundred rows to read there must be a better
way. Advice welcome.

TIA
johnb

Kassie

Rather use a macro that goes to the last row (65000), in the column you
prefer. Then do an <End<Up to the last filled cell in that column.

"johnb" wrote:

Hi all,

I have ssheet thats an daily output from a SAP system and
data is all over the place with many empty columns and
rows. The number of rows change daily and range from a
few hundred to 65000. I current use a For Next loop to
search to whole ssheet and its works fine. But
having "For 1 to 65536" seems a bit crude when there is
only a few hundred rows to read there must be a better
way. Advice welcome.

TIA
johnb


Bob Phillips



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kassie" wrote in message
...
Rather use a macro that goes to the last row (65000), in the column you
prefer. Then do an <End<Up to the last filled cell in that column.

"johnb" wrote:

Hi all,

I have ssheet thats an daily output from a SAP system and
data is all over the place with many empty columns and
rows. The number of rows change daily and range from a
few hundred to 65000. I current use a For Next loop to
search to whole ssheet and its works fine. But
having "For 1 to 65536" seems a bit crude when there is
only a few hundred rows to read there must be a better
way. Advice welcome.

TIA
johnb




Bob Phillips


For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
....

--

HTH

RP
(remove nothere from the email address if mailing direct)


"johnb" wrote in message
...
Hi all,

I have ssheet thats an daily output from a SAP system and
data is all over the place with many empty columns and
rows. The number of rows change daily and range from a
few hundred to 65000. I current use a For Next loop to
search to whole ssheet and its works fine. But
having "For 1 to 65536" seems a bit crude when there is
only a few hundred rows to read there must be a better
way. Advice welcome.

TIA
johnb





All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com