+ Reply to Thread
Results 1 to 3 of 3

VBA .value to 1 decimal place

  1. #1
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    VBA .value to 1 decimal place

    I have some code to assign the value of a cell to a variable in VBA.

    For example:

    Value1 = Sheets("Sheet 1").cells(3,1).value

    And I'd like put this value in another cell, but just to 1 decimal place even if there is a 0. I don't want to format the cell to 1 decimal place, I want the actual value to be 1 decimal place.

    Any ideas?

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

    Re: VBA .value to 1 decimal place

    Try:
    Please Login or Register  to view this content.
    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...

  3. #3
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: VBA .value to 1 decimal place

    Use the Round() function to round the value to a specified number of decimal places but don't forget that cell formatting will also be a factor. If the result of the rounding is, for example, exactly 3.0 then default cell formatting will not show the decimal...

+ 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. Decimal place help
    By dragonball99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2016, 03:07 PM
  2. [SOLVED] Sum of range picking up ^-10 decimal place. Is there a way to sum 2 decimal place only?
    By graym463 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2015, 08:48 AM
  3. Formula to place a decimal
    By mhamilton703 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-10-2014, 04:09 PM
  4. Decimal place Help
    By cadk73 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-26-2012, 03:56 PM
  5. Decimal Place Help
    By cadk73 in forum Excel General
    Replies: 4
    Last Post: 02-14-2012, 08:11 PM
  6. Decimal Place
    By Pale Cloud in forum Excel General
    Replies: 6
    Last Post: 04-06-2011, 05:54 AM
  7. Replies: 3
    Last Post: 03-18-2006, 02:25 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