Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Extend row down by 1

I need to identify and highlight the last row of data in my worksheet, and
extend the whole row down by one row, to capture any new data that might be
available.

How can this be written in vb code? (I need to incorporate this step into a
macro, which will then be run every week with the source data also being
updated weekly)

Many thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Extend row down by 1

Sarah,

Say you expanding column of data are in column A, this will set a range for
that growing data

lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A2:A" & lastrow)

Mike
"Sarah (OGI)" wrote:

I need to identify and highlight the last row of data in my worksheet, and
extend the whole row down by one row, to capture any new data that might be
available.

How can this be written in vb code? (I need to incorporate this step into a
macro, which will then be run every week with the source data also being
updated weekly)

Many thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Extend row down by 1

Adding to Mike's response, the code he provided will identify the last row of
data in column A and assign it to a variable at the instant that the code is
run. If you then add three rows of data, the actual last row will have
changed but the value of the variable will not change unless those lines of
code are executed again. So, you can either use the last row variable as a
reference point and offset from it as your range size increases, or contruct
your code so that the variable value is recalculated by runing the code lines
after any change in the range size.

"Sarah (OGI)" wrote:

I need to identify and highlight the last row of data in my worksheet, and
extend the whole row down by one row, to capture any new data that might be
available.

How can this be written in vb code? (I need to incorporate this step into a
macro, which will then be run every week with the source data also being
updated weekly)

Many thanks in advance.

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
Extend series Traci Excel Worksheet Functions 5 June 17th 06 03:32 AM
Extend formulas nc Excel Discussion (Misc queries) 2 September 26th 05 03:33 PM
Extend to more columns teresa Excel Programming 2 December 31st 04 04:29 PM
extend vlookup Noctos[_9_] Excel Programming 1 January 2nd 04 06:10 PM
extend selection indu aronson Excel Programming 1 December 4th 03 09:31 PM


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

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"