ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem resizing range in vba (https://www.excelbanter.com/excel-programming/377124-problem-resizing-range-vba.html)

RHC

problem resizing range in vba
 
Access 2000 to Excel 2000

I have a worksheet with a cell wide range called adjustments (A1) above
another
range named GL Balance at (A4). I want to use xlRng.CopyFromRecordset to
update the adjustment range. The number of rows in the recordset can vary so
I need to resize the range so that it inserts additional rows between itself
and the GLBalance range. I have tried xlRng.resize(i) where i is the number
of rows and this overwrites whats in the cells below it. And I have tried
xlRng.rows(i).insert xlShiftDown and this doesnt seems to insert but just
fill cells until its hits the next range (GLBalance) and then stops. So how
do I increase the size of a range by shifting everything below it down?
thanks in advance.

Jim Cone

problem resizing range in vba
 
Rows are inserted above a specified range when you shift down, so...
Rows(4).Resize(i).Insert Shift:=xlDown
- or -
Range("GLBalance").EntireRow.Resize(i).Insert Shift:=xlDown
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"RHC"
wrote in message
Access 2000 to Excel 2000
I have a worksheet with a cell wide range called adjustments (A1) above
another
range named GL Balance at (A4). I want to use xlRng.CopyFromRecordset to
update the adjustment range. The number of rows in the recordset can vary so
I need to resize the range so that it inserts additional rows between itself
and the GLBalance range. I have tried xlRng.resize(i) where i is the number
of rows and this overwrites whats in the cells below it. And I have tried
xlRng.rows(i).insert xlShiftDown and this doesnt seems to insert but just
fill cells until its hits the next range (GLBalance) and then stops. So how
do I increase the size of a range by shifting everything below it down?
thanks in advance.


All times are GMT +1. The time now is 06:24 AM.

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