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

  • SEARCH
  • Home
  • 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 7531865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:17:16+00:00 2026-05-30T05:17:16+00:00

My quote generator creates an Excel document and I want to run a macro

  • 0

My quote generator creates an Excel document and I want to run a macro on it to just keep it’s calculations. For some reason it says ‘Number stored as text’ when there are numbers. How can I change them to the number format using the macro? I have found out if I click once in the formula bar, the problem is solved too.

The code below is what I have now, but it won’t solve the error.

Range("A1:A" & LastRow).Select
Selection.NumberFormat = "0"

Column A contains an amount (1, 2, 3, etc). I have another column with the same problem, but this contains a currency in € and has 2 decimal places.

Range("I1:I" & LastRow).Select
Selection.NumberFormat = "0.00"

enter image description here

Thanks for your help! 🙂

Extra shoutout to Siddharth who helped me complete this complete issue.

  • 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-05-30T05:17:17+00:00Added an answer on May 30, 2026 at 5:17 am

    Tom,

    There are 3 ways to solve this

    1) Go Back to your quote generator and see how it is saving the data to Excel Sheet and amend the code there

    2) Manually: Highlight the Range and click on the exclamation mark next to the Green Triangle and click on “Convert to Number” See snapshot

    enter image description here

    3) Use this code.

    Sub Sample()
    Dim LastRow As Long, i As Long
    
    LastRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
    
    Sheets("Sheet1").Range("A1:A" & LastRow).NumberFormat = "0"
    
    For i = 1 To LastRow
        If Val(Sheets("Sheet1").Range("A" & i).Value) <> 0 Then _
        Sheets("Sheet1").Range("A" & i).Formula = _
        Val(Sheets("Sheet1").Range("A" & i).Value)
    Next i
    
    Dim temp As Double
    
    LastRow = Sheets("Sheet1").Range("I" & Rows.Count).End(xlUp).Row
    
    Sheets("Sheet1").Range("I1:I" & LastRow).NumberFormat = "\$#,##0.00"
    
    For i = 1 To LastRow
        If Val(Sheets("Sheet1").Range("I" & i).Value) <> 0 Then
        temp = Sheets("Sheet1").Range("I" & i).Value
        Sheets("Sheet1").Range("I" & i).ClearContents
        Sheets("Sheet1").Range("I" & i).Value = temp
        End If
    Next i
    End Sub
    

    FOLLOW UP

    Before and After snapshot attached

    enter image description here

    MORE FOLLOW UP (IMPORTANT)

    If you have different regional settings then you will have to take care of them appropriately.

    For Example Dutch Belgium you have to use “,” for a decimal. Please see snapshot.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've tried using this code and this to make a random quote generator, but
I'm trying to create a random quote generator. I have created a function called
So I created images generator (quite simple onewhich generates RGBs) I want to be
I have a number of Python generators, which I want to combine into a
I have quite big document in html format that generated from Microsoft Word. It
Quote from Wikipedia : A public key token. This is a 64-bit hash of
Quote from Head first html: You can add padding to the top and bottom
Quote from Jason Coco it not possible to set multiple in UILabel... but how
Quote from hib official docs: Starting with version 3.0.1, Hibernate added the SessionFactory.getCurrentSession() method.
I need help in this matter: We have a template of Excel file in

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.