+ Reply to Thread
Results 1 to 4 of 4

Number Printing

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Number Printing

    Hi All,

    I want to print the numbers on excel based on the input taken. For example, if have entered the value 10. In excel the value from 1 to 10 to be displayed on the column-like below
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,782

    Re: Number Printing

    With your reference number in D2, this in A1 copied down as far as you will ever need:

    =IF(ROW()>$D$1,"",ROW())
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Number Printing

    Put this code in the Workbook module:

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        Dim arr() As Variant
        On Error GoTo Terminate
        If Target.Cells.Count = 1 And Target.Row = 1 And IsNumeric(Target.Value) Then
            Application.EnableEvents = False
            Target.Resize(Target.Value) = Evaluate("Row(1:" & Target.Value & ")")
        End If
    Terminate:
        Application.EnableEvents = True
    End Sub
    Now whenever you enter a number into Row 1, a sequential list of numbers from 1 to that number will be listed in that column.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,342

    Re: Number Printing

    My take on this one...Enter any number into A1
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim num As Long
    If Not Intersect(Target, Range("A1")) Is Nothing Then
        Application.EnableEvents = False
        Rows("2:" & Rows.Count).ClearContents
        With Target
            num = .Value
            .value = 1
            .Resize(num).DataSeries
        End With
        Application.EnableEvents = True
    End If
    End Sub
    Last edited by sintek; 07-30-2019 at 11:10 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. printing page number while printing entire workbook
    By shakir1401 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-23-2015, 06:06 PM
  2. How to bypass NE number for printing through VBA
    By Kezzaman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-30-2012, 02:54 AM
  3. Number of Copies - Printing
    By janjan_376 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-11-2008, 12:20 PM
  4. Printing copy number
    By Dockery in forum Excel General
    Replies: 2
    Last Post: 07-13-2007, 04:47 AM
  5. [SOLVED] After printing, it will be given a new number
    By momotaro in forum Excel General
    Replies: 0
    Last Post: 03-16-2006, 12:10 PM
  6. Different Number on Printing
    By Neemers in forum Excel General
    Replies: 1
    Last Post: 03-08-2005, 05:06 PM
  7. Page number is printing out
    By kimmyrt in forum Excel General
    Replies: 0
    Last Post: 01-07-2005, 03:43 PM

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