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
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
Provided that the rows of data are consecutive (no blank rows) you can use the CountA function to find the last row with data. To get the next one, simply add 1 to it. To call the CountA function in VBA use:
Application.WorksheetFunctions.CountA
Post back if you need a code sample.
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
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks