Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pasting after last record

Hi all

I am cutting and pasting between worksheets using a macro and need to add
records to the end of a list, i.e. have already pasted 2000 rows, and want to
paste starting from row 2001, but am not able to specify the row number as it
varies every time.

Is there a vba command that will automatically paste after last row?

Thanks in advance

Andy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Pasting after last record

Try this (or variations of it)
Range("a1").CurrentRegion.End(xlDown).Offset(1, 0).Select

Starting form somewhere in the existing data (above, "a1")
Current Region.end(xlDown) will take you to the last entry (the end being
determined by blank cells)
Offset(1,0) goes down one row further than that.
This illustration then Selects that cell, you can do other things, such as
Paste.

"Andy Wilkinson" wrote:

Hi all

I am cutting and pasting between worksheets using a macro and need to add
records to the end of a list, i.e. have already pasted 2000 rows, and want to
paste starting from row 2001, but am not able to specify the row number as it
varies every time.

Is there a vba command that will automatically paste after last row?

Thanks in advance

Andy

  #3   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Pasting after last record

Some mo

Assuming that none of the records can have the cell in column [A] empty
(change the column letter as appropriate):

Sheets(1).Cells(65356,"A").End(xlUp).Row+1

Regards,
KL


"Adrian" wrote in message
...
Try this (or variations of it)
Range("a1").CurrentRegion.End(xlDown).Offset(1, 0).Select

Starting form somewhere in the existing data (above, "a1")
Current Region.end(xlDown) will take you to the last entry (the end being
determined by blank cells)
Offset(1,0) goes down one row further than that.
This illustration then Selects that cell, you can do other things, such as
Paste.

"Andy Wilkinson" wrote:

Hi all

I am cutting and pasting between worksheets using a macro and need to add
records to the end of a list, i.e. have already pasted 2000 rows, and
want to
paste starting from row 2001, but am not able to specify the row number
as it
varies every time.

Is there a vba command that will automatically paste after last row?

Thanks in advance

Andy



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Pasting after last record

There are many different way to get the last row, the two I like a
Dim lRow as long
lRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
lRow = Range("A" & Rows.Count).End(xlUp).Row

Note that there's no 'hardcoding' of the know last row (65356). This way if
a newer version of Excel allows more rows there no need to change the code to
find the last row.

"KL" wrote:

Some mo

Assuming that none of the records can have the cell in column [A] empty
(change the column letter as appropriate):

Sheets(1).Cells(65356,"A").End(xlUp).Row+1

Regards,
KL


"Adrian" wrote in message
...
Try this (or variations of it)
Range("a1").CurrentRegion.End(xlDown).Offset(1, 0).Select

Starting form somewhere in the existing data (above, "a1")
Current Region.end(xlDown) will take you to the last entry (the end being
determined by blank cells)
Offset(1,0) goes down one row further than that.
This illustration then Selects that cell, you can do other things, such as
Paste.

"Andy Wilkinson" wrote:

Hi all

I am cutting and pasting between worksheets using a macro and need to add
records to the end of a list, i.e. have already pasted 2000 rows, and
want to
paste starting from row 2001, but am not able to specify the row number
as it
varies every time.

Is there a vba command that will automatically paste after last row?

Thanks in advance

Andy




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to have a record number change for every record Puget Sound Courier Service Excel Discussion (Misc queries) 1 July 12th 09 03:32 PM
Open new record with selected fields from previous record Design by Sue Excel Discussion (Misc queries) 1 June 12th 09 02:24 PM
Finding last record in month for each of several types of record. Richard Buttrey Excel Programming 5 April 4th 05 02:11 AM
Record Macro - Record custom user actions Sal[_4_] Excel Programming 1 December 23rd 04 03:18 PM
Need help autopopulating next new record with previous record data Harry S[_3_] Excel Programming 2 October 1st 03 10:59 PM


All times are GMT +1. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"