PC Review


Reply
Thread Tools Rate Thread

Cell Insertion

 
 
=?Utf-8?B?TWF0dGhldyBXaWVkZXI=?=
Guest
Posts: n/a
 
      2nd May 2007
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 With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      2nd May 2007
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 <F42F6A64-C430-403B-B78A-(E-Mail Removed)>,
Matthew Wieder <(E-Mail Removed)> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File name insertion in cell balterson Microsoft Excel Worksheet Functions 3 22nd Oct 2009 09:35 PM
cell insertion in a sentence RYNNER Microsoft Excel Misc 3 23rd Feb 2009 01:55 PM
Disable cell reference insertion with PageUp in cell edit mode. Greta Microsoft Excel Misc 0 21st May 2008 03:54 PM
Cell insertion if values not matching Susan Microsoft Excel Worksheet Functions 2 12th May 2008 05:05 PM
Cell value comparison w/ cell insertion Susan Microsoft Excel Misc 0 6th May 2008 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:14 PM.