Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8114321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:06:51+00:00 2026-06-06T03:06:51+00:00

I have an excel file, validating one column to enter numbers only but it

  • 0

I have an excel file, validating one column to enter numbers only but it is formatted as if the number is less than 18 the leading zeros will be added. But now the number after 15th digit it will be converting to 0 ex: “002130021300020789”, the nine is changed as 0. After converting the column to text, its accepting but i am not able to add the leading zeros and not able to restrict to input onlu numbers.

Appreciate any help.. thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:06:52+00:00Added an answer on June 6, 2026 at 3:06 am

    MS Article: Excel follows the IEEE 754 specification on how to store and calculate floating-point numbers. Excel therefore stores only 15 significant digits in a number, and changes digits after the fifteenth place to zeroes.

    To get your number formatting and to also ensure that the user enters only numbers you can do this. I am assuming that you are validating the text in Range A1. Please amend as applicable.

    Private Sub Worksheet_Change(ByVal Target As Range)
        On Error GoTo Whoa
    
        Application.EnableEvents = False
    
        If Not Intersect(Target, Range("A1")) Is Nothing Then
            '~~> If entered text is not a number then erase input
            If Not IsNumeric(Range("A1").Value) Then
                MsgBox "invalid Input"
                Application.Undo
                GoTo LetsContinue
            End If
    
            Range("A1").Value = "'" & Format(Range("A1").Value, "000000000000000000")
        End If
    
    LetsContinue:
        Application.EnableEvents = True
        Exit Sub
    Whoa:
        MsgBox Err.Description
        Resume LetsContinue
    End Sub
    

    FOLLOWUP

    If you are copying and pasting then you will have to first format the Range G11:G65536 manually as TEXT and then use this code

    SNAPSHOT (When Pasting Numeric Values)

    enter image description here

    SNAPSHOT (When Pasting Non Numeric Values)

    enter image description here

    CODE

    Private Sub Worksheet_Change(ByVal Target As Range)
        On Error GoTo Whoa
    
        Dim cl As Range
    
        Application.EnableEvents = False
    
        If Not Intersect(Target, Range("G11:G" & Rows.Count)) Is Nothing Then
            For Each cl In Target.Cells
                '~~> If entered text is not a number then erase input
                If Not IsNumeric(cl.Value) Then
                    MsgBox "invalid Input"
                    Application.Undo
                    GoTo LetsContinue
                End If
    
                cl.Value = "'" & Format(cl.Value, "000000000000000000")
            Next
        End If
    
    LetsContinue:
        Application.EnableEvents = True
        Exit Sub
    Whoa:
        MsgBox Err.Description
        Resume LetsContinue
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel file with one column which is filled with numbers. I
I have an excel file that has a column that contains a number of
I have an excel file with 10,000 rows in column A some values are
We have an Excel file with a worksheet containing people records. 1. Phone Number
I have an Excel file (which has data imported from Oracle 10G Database) one
I have an Excel file that contains a column full of dates in the
I have an Excel file where some of the column information is blank. I
I have an excel file which has more than 65536 rows. However, I can
i have one excel file that contains a 1 to a5 rows with values
I have an excel file and I want to read each column and create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.