ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Visual Basic insert formula (https://www.excelbanter.com/excel-discussion-misc-queries/265960-visual-basic-insert-formula.html)

Pavlov Bell

Visual Basic insert formula
 
Hi,

I am trying to set a macro to do the following: insert the formula in the active cell (or in each cells selected). Formula: "=round( 'activecell value' ;0)"

The activecell could have a number like: 5,68 or a formula: A1+A2.

Can someone help!

Thanks a lot.

David of XL Plus

Quote:

Originally Posted by Pavlov Bell (Post 959531)
Hi,

I am trying to set a macro to do the following: insert the formula in the active cell (or in each cells selected). Formula: "=round( 'activecell value' ;0)"

The activecell could have a number like: 5,68 or a formula: A1+A2.

Can someone help!

Thanks a lot.

Hi,

Best way to begin is to use the Macro Recorder.

Then edit that code as necessary.

David

Sepeteus Jedermann

Quote:

Originally Posted by David of XL Plus (Post 959793)
Hi,

Best way to begin is to use the Macro Recorder.

Then edit that code as necessary.

David


Hi,

as David already told to you, use macro recorder.

The following code is made by macrorecorder

Sub NoDecimals()
Selection.NumberFormat = "0"
End Sub

***


All times are GMT +1. The time now is 11:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com