+ Reply to Thread
Results 1 to 23 of 23

Beginner question

Hybrid View

  1. #1
    Tony Vella
    Guest

    Beginner question

    Can I have the program automatically fill 10 columns of 10 rows with numbers
    from 1 to 100? I am using Excel 97 on an XP Home machine. Thanks in
    advance.
    --
    Tony Vella in Ottawa, Canada


  2. #2
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    I'm sure there are tons of ways to do this. Here's one.
    1. Enter the numbers 1 and 2 in cells A1 and B1 respectively
    2. Highlight cells A1 and B1
    3. Right click hold the small square in the lower right hand corner of the highlighted range.
    4. Drag over 8 more columns, let the mouse button go and select fill series
    5. Now select cell A2 and input =A1+10
    6. Copy Cell A2 to Cells A2:J10
    7. copy the entire range and paste values over them
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

  3. #3
    Biff
    Guest

    Re: Beginner question

    Hi!

    How do you want the output?

    1...........10
    11.........20

    Or:

    1...11...21
    2...12...22

    For the first example, enter this formula in top left cell of the grid:

    =COLUMNS($A:A)+(ROWS($1:1)-1)*10

    For the second example:

    =ROWS($1:1)+(COLUMNS($A:A)-1)*10

    Copy the formula across to 10 columns then down 10 rows.

    Then, if you want to get rid of the formulas and convert them to constants:

    Select the grid of cells
    Goto Edit>Copy
    Then, Edit>Paste Special>Values>OK

    Biff

    "Tony Vella" <tony.vella@rogers.com> wrote in message
    news:waWdnYwGzpVPNU_ZnZ2dnUVZ_s2dnZ2d@giganews.com...
    > Can I have the program automatically fill 10 columns of 10 rows with
    > numbers
    > from 1 to 100? I am using Excel 97 on an XP Home machine. Thanks in
    > advance.
    > --
    > Tony Vella in Ottawa, Canada
    >




  4. #4
    L. Howard Kittle
    Guest

    Re: Beginner question

    Hi Tony,

    Here's a couple macros, one for numbers across and one for numbers down.
    For numbers across you will need to name a 10 by 10 cell block Data, or any
    name you wish, and then change Data in the code to your name.

    Sub NumbersAcross()
    Dim Cell As Range
    Dim i As Integer
    i = 1
    For Each Cell In Range("Data")
    Cell.Value = i
    i = i + 1
    Next
    End Sub

    Sub NumbersDown()
    Dim i As Integer
    Dim Cell As Range
    Range("A1").Select
    For i = 1 To 100
    ActiveCell.Value = i
    ActiveCell.Offset(1, 0).Select
    If ActiveCell.Row = 11 Then
    ActiveCell.Offset(-10, 1).Select
    End If
    Next
    End Sub

    HTH
    Regards,
    Howard

    "Tony Vella" <tony.vella@rogers.com> wrote in message
    news:waWdnYwGzpVPNU_ZnZ2dnUVZ_s2dnZ2d@giganews.com...
    > Can I have the program automatically fill 10 columns of 10 rows with
    > numbers
    > from 1 to 100? I am using Excel 97 on an XP Home machine. Thanks in
    > advance.
    > --
    > Tony Vella in Ottawa, Canada
    >




  5. #5
    Gord Dibben
    Guest

    Re: Beginner question

    Here's a macro that allows you to choose your orientation and range.

    Who knows.......maybe some day you will need 115 x 186 matrix<g>

    Sub FillNums()
    'to fill rows and columns with numbers from 1 to whatever
    Dim nrows As Integer
    Dim ncols As Integer
    On Error GoTo quitnow
    RowsorCols = InputBox("Fill Across = 1" & Chr(13) _
    & "Fill Down = 2")
    Num = 1
    nrows = InputBox("Enter Number of Rows")
    ncols = InputBox("Enter Number of Columns")
    If RowsorCols = 1 Then
    For across = 1 To nrows
    For down = 1 To ncols
    ActiveSheet.Cells(across, down).Value = Num
    Num = Num + 1
    Next down
    Next across
    Else
    For across = 1 To ncols
    For down = 1 To nrows
    ActiveSheet.Cells(down, across).Value = Num
    Num = Num + 1
    Next down
    Next across
    End If
    quitnow:
    End Sub


    Gord Dibben MS Excel MVP

    On Fri, 4 Aug 2006 14:01:31 -0700, "L. Howard Kittle" <lhkittle@comcast.net>
    wrote:

    >Hi Tony,
    >
    >Here's a couple macros, one for numbers across and one for numbers down.
    >For numbers across you will need to name a 10 by 10 cell block Data, or any
    >name you wish, and then change Data in the code to your name.
    >
    >Sub NumbersAcross()
    >Dim Cell As Range
    >Dim i As Integer
    >i = 1
    >For Each Cell In Range("Data")
    > Cell.Value = i
    > i = i + 1
    >Next
    >End Sub
    >
    >Sub NumbersDown()
    >Dim i As Integer
    >Dim Cell As Range
    >Range("A1").Select
    >For i = 1 To 100
    > ActiveCell.Value = i
    > ActiveCell.Offset(1, 0).Select
    > If ActiveCell.Row = 11 Then
    > ActiveCell.Offset(-10, 1).Select
    > End If
    >Next
    >End Sub
    >
    >HTH
    >Regards,
    >Howard
    >
    >"Tony Vella" <tony.vella@rogers.com> wrote in message
    >news:waWdnYwGzpVPNU_ZnZ2dnUVZ_s2dnZ2d@giganews.com...
    >> Can I have the program automatically fill 10 columns of 10 rows with
    >> numbers
    >> from 1 to 100? I am using Excel 97 on an XP Home machine. Thanks in
    >> advance.
    >> --
    >> Tony Vella in Ottawa, Canada
    >>

    >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1