Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Append new row of data to range
Say you have a rectangular range named rngData on your
worksheet, and you want to add a new row of data to the bottom, expanding rngData accordingly. What's the most straightforward way to do this in code? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Append new row of data to range
Art,
Try something like With Range("rngData") .Cells(.Cells.Count + 1).EntireRow.Insert xlDown ThisWorkbook.Names.Add "rngData", .Resize(.Rows.Count + 1) End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Art" wrote in message ... Say you have a rectangular range named rngData on your worksheet, and you want to add a new row of data to the bottom, expanding rngData accordingly. What's the most straightforward way to do this in code? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Append new row of data to range
Assume rngData is a variable of type Range
set rngData = rngData.Resize(rngdata.rows.count+1) Assume rngData is a defined name set rng = Range("rngData") rng.Resize(rng.rows.count+1).Name = "rngData" Demo'd from the immediate window: set rngData = Range("A1:Z26") set rngData = rngData.Resize(rngdata.rows.count+1) ? rngData.Address $A$1:$Z$27 Range("A1:Z26").Name = "rngData" set rng = Range("rngData") rng.Resize(rng.rows.count+1).Name = "rngData" ? Range("rngData").Address $A$1:$Z$27 -- Regards, Tom Ogilvy Art wrote in message ... Say you have a rectangular range named rngData on your worksheet, and you want to add a new row of data to the bottom, expanding rngData accordingly. What's the most straightforward way to do this in code? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Thanks again Tom!
-----Original Message----- Assume rngData is a variable of type Range set rngData = rngData.Resize(rngdata.rows.count+1) Assume rngData is a defined name set rng = Range("rngData") rng.Resize(rng.rows.count+1).Name = "rngData" Demo'd from the immediate window: set rngData = Range("A1:Z26") set rngData = rngData.Resize(rngdata.rows.count+1) ? rngData.Address $A$1:$Z$27 Range("A1:Z26").Name = "rngData" set rng = Range("rngData") rng.Resize(rng.rows.count+1).Name = "rngData" ? Range("rngData").Address $A$1:$Z$27 -- Regards, Tom Ogilvy Art wrote in message ... Say you have a rectangular range named rngData on your worksheet, and you want to add a new row of data to the bottom, expanding rngData accordingly. What's the most straightforward way to do this in code? . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Append new row of data to range
-----Original Message----- Say you have a rectangular range named rngData on your worksheet, and you want to add a new row of data to the bottom, expanding rngData accordingly. What's the most straightforward way to do this in code? .Type it in |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Append Data From Two Files | Excel Discussion (Misc queries) | |||
append column data | Excel Worksheet Functions | |||
append worksheet with data from another | Excel Worksheet Functions | |||
how do i append old and new data in excel | Excel Worksheet Functions | |||
Auto append data | Excel Discussion (Misc queries) |