Auto Fill the Range Between 2 Cells

JIN - Feb 7, 2009 at 11:52 PM
 JIN - Feb 13, 2009 at 12:09 AM

My Question is

I Have Put One Range Like " 1 " in One cell and ending series " 10 " in next cell . Now I want the excel To Auto Complete the Range from 1 to 10 and put it in another cell . Please tell me how can I do that.

Secondly If I only put one Data in One cell how can I make excel to auto fill the Entire series Automacially without using Autofill option manually but dragging the cell horizontally or vertically.

Your Help will be appreciated

1 reply

I'm not sure this answers your question, but this will fill the range from A1:A10 with the numbers
one throught ten.

Private Sub FillRange()

Dim i
i = 1

Do While I < 11

Range("A" & i) = i

i = I + 1


End Sub

I'm not sure about your second question. If you put data in one cell and then use Autofill, Excel assumes that is the data you want to fill in the range.
If you put the number 1 in cell A1 and then use autofill to range A10, Excel will fill the whole range with the number 1.

If you put the number 1 in cell A1 and the number 2 in cell A2, highlight both cell A1 and A2 then use Autofill,
then you are giving a "Step" value, so excel will fill the range 1,2,3,4....... until you stop Autofill.
Can you please eloborate a bit more where to use this dim function

Perhaps , an example will be very easy for me to understand . If Possible can you please make an excel file and share it here so that I can have a look on it and understand . with the same scenario which I mention earlier.
Example given in the following file.
I have given a brief description of the code.
Click on the command button in the file to see the code run.

Nope I still cant get it.

You have mention this Forumula Earlier.

Please make an Example like this

I have Two Colums

IN Cell B1 I Enter Number 150

Now I want the Entire Number in between Cell A1 And Cell B1 to be Appear Automatically in Cell A3 or Any Other cell where I want to Put , without doing Manually

Please make an excel and Share
I guess I'm having a hard time understanding.
If you just want to sum the numbers in A1 and B1 then type a sum formula in A2 such as,


See the attached file. Change the numbers in A1 and B1 to see if that is what you want.

Nope thats a Sum fomula I know that

have a look at this

100 150


This Above range from 100 to 150 Should appear when I enter the first 100 and enter the Lase 150 .And this range I want it to appear in any cell where I want this range to appear when I enter the first and last number