+ Reply to Thread
Results 1 to 10 of 10

Excel Macro - how to divide number format only

  1. #1
    Registered User
    Join Date
    10-17-2018
    Location
    Malta
    MS-Off Ver
    2018
    Posts
    7

    Excel Macro - how to divide number format only

    Hi, I have multiple excel sheets each with a great number of data. The problem with the data is that I have a mix of Number format and General format. I want to create a macro which divides the number format by 1000. Any links or ideas please?

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Excel Macro - how to divide number format only

    You may read with VBA current format of the cell. so standard loop shall be enough.

    if your data are just values (not formulas) you may directly use:
    Please Login or Register  to view this content.
    Skip this line, if you prefer to keep previous formatting of changed cells:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    10-17-2018
    Location
    Malta
    MS-Off Ver
    2018
    Posts
    7

    Re: Excel Macro - how to divide number format only

    But is it possible to this using macro? I mean, I currently do not have VBA installed and am quite a newbie on macros but still I think I would prefer to use macros at this point in time

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: Excel Macro - how to divide number format only

    vba and macros in Excel are one and the same. To run Kaper's code:

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Excel Macro - how to divide number format only

    Please see forum rule #3: in future, please tell us if you have asked the same question elsewhere.

    Here is a link to the other forum (please provide these links yourself in future): https://www.excelguru.ca/forums/show...numerical-data
    Last edited by AliGW; 10-17-2018 at 07:24 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    10-17-2018
    Location
    Malta
    MS-Off Ver
    2018
    Posts
    7

    Re: Excel Macro - how to divide number format only

    Alansidman, i managed to do as you instructed and it worked perfectly. Is it possible for me to include the range of columns for this procedure to be done? The first column is date/time and therefore I would prefer this procedure to always skip it

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Excel Macro - how to divide number format only

    If first column is column A then:
    Please Login or Register  to view this content.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Excel Macro - how to divide number format only

    Stefan - you were asked in post #5 to tell us where else you have posted this query. We have now discovered that you have also posted it here: https://www.mrexcel.com/forum/excel-...ic-values.html

    Please be aware that if you continue to ignore our rules and moderation requests, there will be consequences. Please do not do so again. Thank you.

  9. #9
    Registered User
    Join Date
    10-17-2018
    Location
    Malta
    MS-Off Ver
    2018
    Posts
    7

    Re: Excel Macro - how to divide number format only

    I think that the same question was asked in these three forums but I m not sure. At least I have got the replies from these three total. I won't do it again dnt worry.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Excel Macro - how to divide number format only

    I am talking about YOU asking the same thing on multiple forums. You must know where else you have asked the same question, surely?

    If you have had useful replies from the other forums that are different to the ones offered here, then please share them here for the benefit of all. This is a public forum that acts as a knowledge base for hundreds of Excel users: if the data is incomplete, then the knoweldgebase fails to work correctly. I hope you understand, therefore, why we and other forums have the cross-posting rule and why we expect you to abide by it.

+ 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. Macro to divide number of rows evenly and cut/paste on blank worksheets.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-04-2017, 07:33 AM
  2. [SOLVED] Change format into a Europe Number Format and divide with 1000
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-16-2015, 05:26 AM
  3. macro to divide a number once pasted?
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-11-2015, 06:25 PM
  4. [SOLVED] Formula to divide a number and format if greater than a 100
    By Shellybelly in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-10-2014, 07:04 PM
  5. Macro to Divide a Data in Cells and Distribute to X number of Columns
    By paul.serrato in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 12:01 AM
  6. [SOLVED] I need a macro to Divide the last number first first in a row.
    By playaller in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-07-2013, 01:12 PM
  7. [SOLVED] Excel formula divide list of #s by N to get a number above 40
    By JudyK in forum Excel General
    Replies: 11
    Last Post: 02-09-2005, 05: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