Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to automate the following, seemingly simple task, but am having
trouble doing so: I have a range, let's say 4x4. I need to increase that range, by adding cells on the right and below, let's say to end up with 7 x 6. I DO NOT want to insert whole columns and rows - I only want to insert as many cells as run the length of my initial range. Calling Range.Insert seems to insert a whole 4x4 range. Is there any way to specify teh size of what is to be inserted, or am I stuck inserting the size of whatever is selected right at the location it is selected? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Const nADDROWS As Long = 3 Const nADDCOLS As Long = 2 With Selection .Cells(1).Offset(.Rows.Count, 0).Resize( _ nADDROWS, .Columns.Count).Insert _ Shift:=xlShiftDown, _ CopyOrigin:=xlFormatFromLeftOrAbove .Cells(1).Offset(0, .Columns.Count).Resize( _ .Rows.Count + nADDROWS, nADDCOLS).Insert _ Shift:=xlShiftToRight, _ CopyOrigin:=xlFormatFromLeftOrAbove End With In article , Matthew Wieder wrote: I am trying to automate the following, seemingly simple task, but am having trouble doing so: I have a range, let's say 4x4. I need to increase that range, by adding cells on the right and below, let's say to end up with 7 x 6. I DO NOT want to insert whole columns and rows - I only want to insert as many cells as run the length of my initial range. Calling Range.Insert seems to insert a whole 4x4 range. Is there any way to specify teh size of what is to be inserted, or am I stuck inserting the size of whatever is selected right at the location it is selected? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
File name insertion in cell | Excel Worksheet Functions | |||
cell insertion in a sentence | Excel Discussion (Misc queries) | |||
Automatic Symbol Insertion In Cell | Excel Discussion (Misc queries) | |||
Disable cell reference insertion with PageUp in cell edit mode. | Excel Discussion (Misc queries) | |||
Using a Cell Operation for insertion into a Formula | Excel Discussion (Misc queries) |