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 8309923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:16:25+00:00 2026-06-08T19:16:25+00:00

I have this code that aggregates multiple workbooks into a preview file where all

  • 0

I have this code that aggregates multiple workbooks into a preview file where all of the data is clearly laid out in tables and charts. Then those tables and charts are pasted in a PowerPoint presentation.

I am having issues getting the right formatting to work when the values in the tables are copied over to the PowerPoint slides. One of the source worksheets outputs values like 847389.240398230423, and when you try to put that in PowerPoint, you get a value that takes up too many lines and looks like 2.240398230423E-02. That kind of formatting does not look great in any meeting.

I wrote some code that will edit the code while the values are in the Preview workbook

Sheets("Output").Select

'Select1
Range("C10:H15").Select
    Selection.NumberFormat = "0.000"

'Select2
Range("C17:H17").Select
    Selection.NumberFormat = "0.000"

'Select3
Range("C18:H19").Select
    Selection.NumberFormat = "0.00"

'Select4
Range("C20:H21").Select
    Selection.NumberFormat = "0.00"

This code works perfectly for the data that I need and shows up like 0.487, but the actual values in the cells are stuff like 0.487682742490, and I think that is what the code is recognizing when it comes time to update the PowerPoint presentation.

Is there a way that you can write some code that will only take the first 2 or 3 digits after the decimal place and ignore the other non-significant figures?

  • 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-08T19:16:27+00:00Added an answer on June 8, 2026 at 7:16 pm

    There are a few ways to achieve this. One way is to force the formatted/visible data as the actual value.

    For example, let’s say cell A1 contains the value 1.234. Using this code:

    ActiveSheet.Range("A1").NumberFormat = "0.0"
    ActiveSheet.Range("A2").Value = ActiveSheet.Range("A1").Value
    ActiveSheet.Range("A3").Value = ActiveSheet.Range("A1").Text
    

    The result is like so:

    • Cell A1 contains the value 1.234, but displays as 1.2
    • Cell A2 contains the value 1.234, and displays as 1.234
    • Cell A3 contains the value 1.2, and displays as 1.2

    The .Text property of a cell is essentially what you see in the cell. Once you convert your values in this way, transferring to PP should work as intended.


    Alternatively (though not preferred because it is somewhat more cumbersome to use and requires strings, rather than just sticking to values) you can use something like this:

    Dim s As String
    Dim dec As Integer
    
    dec = 2
    s = CStr(ActiveSheet.Range("A1").Value)
    ActiveSheet.Range("A3").Value = CDbl(Left(s, InStr(s, ".")) & Left(Right(s, Len(s) - InStr(s, ".")), dec))
    

    In the above, you can extend the number of decimal places by increasing the value of dec. However, without further modification 1.000 will come out as 1 (removes possibly significant 0’s).

    If you use this method, you can either retain a numeric value (using CDbl()) or keep it as a string if you do not need to perform any arithmetic (i.e. just put into PP).

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

Sidebar

Related Questions

I have this code that reads from XML file. It gets five strings (groupId,
Let's say I have a data mapper function that aggregates multiple tables and generates
I have a query that sums and aggregates alot of data something like this:
I have this code that I've edited: http://pastebin.com/vrqHek6S I've put in comments where I
I have this code that runs but never stops. class A { public static
I have this code that suppose to place the marker by the latlng public
I have this code that where I would normally use one line: if (tableView
I have this code that works in a unit test but doesn't work when
I have this code that I want to make point-free; (\k t -> chr
I have this code that fetches some text from a page using BeautifulSoup soup=

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.