ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count Number of full rows (https://www.excelbanter.com/excel-programming/329894-count-number-full-rows.html)

Jamie

Count Number of full rows
 
Hi There

I am looking to write a macro that opens a spreadsheet, looks at the number
of rows that are occupied by data, then selects the next blank cell to paste
a new line of data from another spreadsheet.

Is this possible?

Jamie

Herbert

Count Number of full rows
 
Hi Jamie!

You can determine the next empty row with:
Dim nNewRow As Long

nNewRow = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row - 1

I hope this helps.

Herbert


"Jamie" wrote:

Hi There

I am looking to write a macro that opens a spreadsheet, looks at the number
of rows that are occupied by data, then selects the next blank cell to paste
a new line of data from another spreadsheet.

Is this possible?

Jamie


Herbert

Count Number of full rows
 
Oh my, I am getting old!

The correct formula is:
nNewRow = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row

Sorry for that!

Herbert

"Herbert" wrote:

Hi Jamie!

You can determine the next empty row with:
Dim nNewRow As Long

nNewRow = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row - 1

I hope this helps.

Herbert


"Jamie" wrote:

Hi There

I am looking to write a macro that opens a spreadsheet, looks at the number
of rows that are occupied by data, then selects the next blank cell to paste
a new line of data from another spreadsheet.

Is this possible?

Jamie



All times are GMT +1. The time now is 07:30 PM.

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