I can think of two options to get Excel to apply the formatting to the cells in one step. The first is to use the Text to columns functionality even though there is nothing in the column to split. The second option is to copy a value of 1 and paste it into the cells using the Paste Special - Multiply option. Although either method should force an update of the cell formating, I would lean towards the first option. This is incase some of your dates are is stored as text.
Vishu wrote: I have data in around 200 cells. I need to go to each cell and press “F2” button and then “Enter” button. Can I have macro codes, that should perform above task in selected cells. I could not get these code by recording. Of course, this is needed, for example, when you entered numbers or formulas into cells originally formatted as Text, then you change the format to General or some other numeric formula. As we know, Excel does not automatically change the cell contents immediately. We must 'edit' each cell by pressing F2, then Enter.
Jan 23, 2019 - When entering numerical data in Excel, it helps to format it according to the type of data it is. Formatting a cell according to its data type—e.g..
FYI, if your original data are constants, you can simply put the number 1 into some cell and copy it, select the cells to 'edit', right-click and click on Paste Special, select Multiply, and press OK. Then you can delete the number 1. But if you have formulas, you can use the following macro. Select the range of cells to change first. The formula works only for cells with constants and non-array-entered formulas.
But then, so does your procedure of pressing F2, then just Enter. Sub reEnter For Each r In Selection r.Formula = r.Formula Next End Sub.