+ Reply to Thread
Results 1 to 13 of 13

How to change cell format to decimal number

  1. #1
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Question How to change cell format to decimal number

    Hello members,
    How can I change the 'cell format' of all columns (A-E) to decimal number for all files (*.csv) in a folder.
    Attached Files Attached Files
    Last edited by Moriexcel; 01-06-2015 at 02:45 AM. Reason: omit the 'save as .dbf' !

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: How to change cell format to decimal number

    i believe the save as .dbf option was removed from excel 2007.

    this will open your books.
    Please Login or Register  to view this content.
    there may be some addin for saving into .dbf though it would seam easer to use a earler version
    Last edited by D_Rennie; 01-06-2015 at 12:38 AM.


  3. #3
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to change cell format to decimal number

    You're right. I've just installed 2003 version! However, more important is to change the cell format.
    The code is for looping through folder. Thank you. Any idea about the main issue?

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: How to change cell format to decimal number

    in the loop Columns("A:E").NumberFormat = "0.00"
    then save each book Workbook.SaveAs Filename:=MyFolder & "\*.dbf" this may not be the correct syntax as i only have 2007 installed so no way of cheeking.
    Last edited by D_Rennie; 01-06-2015 at 01:02 AM.

  5. #5
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to change cell format to decimal number

    I used this code but it is not working

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: How to change cell format to decimal number

    try putting a . in front for columns to qualfiy the line of code to that workbook.

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: How to change cell format to decimal number

    Rennie means this.....

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  8. #8
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to change cell format to decimal number

    Quote Originally Posted by sktneer View Post
    Rennie means this.....

    Please Login or Register  to view this content.
    Nothing was changed ! I used F8 and went through the code line by line, but the mentioned code is not changing the cell format. Although there is no bug in the code.

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: How to change cell format to decimal number

    Quote Originally Posted by Moriexcel View Post
    Nothing was changed ! I used F8 and went through the code line by line, but the mentioned code is not changing the cell format. Although there is no bug in the code.
    May be your Numbers in Columns("A:E") are not real numbers and may be Text Data or Text Numbers


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  10. #10
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to change cell format to decimal number

    Ooo, sorry. That's why I was not mentioned my data format and asked a general question.
    I just attached a sample file to the original question.

  11. #11
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to change cell format to decimal number

    Quote Originally Posted by :) Sixthsense :) View Post
    May be your Numbers in Columns("A:E") are not real numbers and may be Text Data or Text Numbers
    Although there are all not numbers (I have header row), there are all in same format, 'general'.

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: How to change cell format to decimal number

    May be replace this

    Please Login or Register  to view this content.
    With

    Please Login or Register  to view this content.


    And check....

  13. #13
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to change cell format to decimal number

    Thank you all.

    Although nothing changed in Excel, I was noticed cell format changes when I save the files as .dbf
    However, to whom may use this program later, I would suggest to check the results whether the values are changing or not as well.
    Because I learnt that in dbf file, in some cases, decimals are rounded in following way.
    0.1 to 0
    1.5 to 2

    By the way, if anyone found a better way with no error, I will appreciate to mention it here.
    Thank you again.
    Last edited by Moriexcel; 01-06-2015 at 04:30 AM.

+ 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. Vba to format number of decimal places dependant on number in another cell
    By wonderdunder in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2012, 09:33 AM
  2. How to change the number of decimal places in a variable cell reference...
    By kenab1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2010, 01:32 PM
  3. " / " Changing Decimal number format to Fraction on Protected Cell
    By laudie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-14-2005, 10:15 PM
  4. [SOLVED] " / " Changing Decimal number format to Fraction on Protected Cell
    By laudie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-14-2005, 09:15 PM
  5. Replies: 8
    Last Post: 04-20-2005, 12:06 PM

Tags for this Thread

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