View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
alf bryn alf bryn is offline
external usenet poster
 
Posts: 31
Default Insert Function Problem

Experimenting a bit it seems to me that Excel shifts the data to the right
if the number in B25 than the number of columns in the range (i.e B to G =
6) .

For values of B25=6 or less data gets shifted down.

As Jim and Norman said. Excel moves in mysterious ways it's wonders to
preform.


"Jim Thomlinson" wrote in message
...
Unless you specifically tell Excel what to do then it makes best guesses
for
you. Depending on what your data looks like it will decide whether to
shift
down of to the right. Change your code to be ...

Range("B26:G26").Resize(Range("b25").Value).Insert xlDown
or
Range("B26:G26").Resize(Range("b25").Value).Insert xlToRight

Depending on what you want to do...
--
HTH...

Jim Thomlinson


"zero635" wrote:


Ok, I am using the following code to insert rows below a header.

Sub InsertRange()

Range("B26:G26").Resize(Range("b25").Value).Insert

End Sub

Well, with a value of 8 or greater in cell "B25", my data below it
shifts to the right.

With a value of 7 or less it shifts the data below down and gives me
the empty spaces I need.

Can anyone tell me why a value of 8 or greater would cause this formula
to shift my data to the right, instead of down like a normal insertion?

Thank You,
Chris


--
zero635
------------------------------------------------------------------------
zero635's Profile:
http://www.excelforum.com/member.php...o&userid=24802
View this thread:
http://www.excelforum.com/showthread...hreadid=388048