Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Cell Insertion

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Cell Insertion

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
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
File name insertion in cell balterson Excel Worksheet Functions 3 October 22nd 09 09:35 PM
cell insertion in a sentence RYNNER Excel Discussion (Misc queries) 3 February 23rd 09 01:55 PM
Automatic Symbol Insertion In Cell Microconfusion Excel Discussion (Misc queries) 1 August 14th 08 11:45 PM
Disable cell reference insertion with PageUp in cell edit mode. Greta Excel Discussion (Misc queries) 0 May 21st 08 03:54 PM
Using a Cell Operation for insertion into a Formula JCary Excel Discussion (Misc queries) 1 March 4th 06 12:22 AM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"