|
Format Cells in The Number (Numerical) Number Format in Excel
This free Excel macro formats selected cells in the Number or Numerical number format in Excel. This means that the cell is formatted as a number and has two decimal places showing by default. This is the format that you want to use when formatting things such as part numbers, I.D. numbers, mathematical formulas and data entry, etc.
This macro allows you to quickly format large selections of cells in Excel and is helpful when you need to tidy up spreadsheets or simply make them more presentable.
Where to install the macro: Module
Excel Macro to Format Cells in The Number (Numerical) Number Format in Excel
Sub Format_Cell_Number()
Selection.NumberFormat = "0.00"
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
Hi,
I need a macro which will help me in changing the format of a cell containing Number to Text Format without change in Decimal Values.
i.e for eg . in a Cell if we use some formula & get some numeric value let say 10000.00. Now i have to remove formula & I have to retain only value but the format should be "TEXT" i.e 10000.00 only.
I tried doing it maually but when i do this i am getting value as 10000 not 10000.00 .
102.10 is displayed as 102.1 --- 1002.50 as 1002.5---- 1002.00 as 1002 etc
i,e decimals r not displayed
I want the value with two decimals .ie 102.03 , 1001.01 etc.
Please assist me
I have been working in a worksheet with 10 tabs, and suddenly all of my numbers turned to long date format. I manually changed them all back to what they were. General, Currency, %, etc. but the default seems to be stuck in the long date format. When I create a new tab it is automatically all long dates. Very strange.
Oh, and the other weird thing is when I send it to other people, some people see the correct formats and when other's open it the numbers all go back to the long date format. VERY Frustrating.
Would love to get some advice.
Excel 2000
I have two files, one master and one created by opening a text file. The
master file has a list of unique product codes and descriptions in two
columns, the text that is opened has the product codes and I add during the
opening process a look up to the product code to return the product
description, this all works fine. The text file after opening is 7 columns,
product code, product description and 5 columns of numbers.
What I need to do is format the cells (numbers) in the last 5 columns of the
newly opened text file. My thoughts are to add a third column to the master
file whereby I'll have 3 columns: product code, product description and
number format, in the number format column I would format the cell with the
required number format. My issue is, how using VBA do I format the cells in
the newly opened text file where the product code matches that of the
corresponding product code in the master file. The text file can have many
of the same product codes and in some instances, not all of the product
codes.
I had also thought of Conditioning Format but alas, this doesn't cover
number formatting.
Any pointers, snippets of code most welcome.
Thanks, Rob
In excel, I tried to convert numbers to number format, using
format/cells/number from the category list. But it won't take, and stays
text-like. Any ideas?
I am entering in ID's that have 2 zero's at the start of each number but the zero's are dropping off when I move out of the cell e.g. 0021676 becomes 21676. I can't find anything in the format cells option to rectify this.
If someone could advise of a quick fix for this it would be greatly appreciated.
Hello All:
Does anyone know of a way to change a number formatted cell (i.e. $2,455.00) into a text format and still maintain the "$" and "," ??
I need to enter full credit card numbers into an excel sheet that is
created to keep track of transactions. I need to see only the last 4
digits, though.
Tried many things so i hope you guys can help me figure this one out.
I want to change the Entire D column Number format to 1234.10 from -1234.10 when i changed this its getting reflect only for that session when i re-open the excel file its not reflecting.how can i make this format permamnent
I am importing delimited textfile into excel text file does have 312.10,450.10 when these values comes to excel sheet values are displaying like 312.1,450.1 so "0" is missing.I really thankfull to you if any one provide solution.
Hello everyone,
I have a question about Format Cells > Number > Custom
I have a cell for example, cell A1, that I formatted (Format > Number > Custom) and I want to always show 6 numeric places if you will "000000"
Is there a way, VBA code, if I enter a number 5 in cell F1 that the 6 numeric places in cell A1 will change from 6 "000000" to 5 "00000"
I have a number of cells that this would affect not just cell A1. Cell F1 would be more or less like a trigger. If I enter a 6 in cell F1, cell A1 would be formatted with 6 "000000" and if I entered a 5 in cell F1, cell A1 would be formatted with 5 "00000"
Thanks!!
Numbers in my spreadsheet are always to 2 decimal places even though I have set the number format to 0. Have I lost a template or something?
|
|