ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Pls help on Macro - round formula (https://www.excelbanter.com/excel-discussion-misc-queries/192344-pls-help-macro-round-formula.html)

Eastar

Pls help on Macro - round formula
 
A small data base
A B
1 3.3456 6.3535
2 4.5656 10.3265

Want to set up a macro to round the data,Macro as below
Range("d1:e2").Select
Selection.Formula = "ROUND(RC[-3],2)

The result I got is ROUND(RC[-3],2), instead of numbers (3.35, 6.36 .etc.)


thanks


Sandy Mann

Pls help on Macro - round formula
 
You need an equals sign within the quotes as well:

Selection.Formula = "=ROUND(RC[-3],2)"

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Eastar" wrote in message
...
A small data base
A B
1 3.3456 6.3535
2 4.5656 10.3265

Want to set up a macro to round the data,Macro as below
Range("d1:e2").Select
Selection.Formula = "ROUND(RC[-3],2)

The result I got is ROUND(RC[-3],2), instead of numbers (3.35, 6.36 .etc.)


thanks





Dave Peterson

Pls help on Macro - round formula
 
How about adding the equal sign and using .formulaR1C1:
Selection.FormulaR1C1 = "=ROUND(RC[-3],2)"

Or even:
Range("d1:e2").formular1c1 = "=ROUND(RC[-3],2)"
(Dropping the .select line)


Eastar wrote:

A small data base
A B
1 3.3456 6.3535
2 4.5656 10.3265

Want to set up a macro to round the data,Macro as below
Range("d1:e2").Select
Selection.Formula = "ROUND(RC[-3],2)

The result I got is ROUND(RC[-3],2), instead of numbers (3.35, 6.36 .etc.)

thanks


--

Dave Peterson

Eastar

Pls help on Macro - round formula
 
Thank you very much, guys

"Dave Peterson" wrote:

How about adding the equal sign and using .formulaR1C1:
Selection.FormulaR1C1 = "=ROUND(RC[-3],2)"

Or even:
Range("d1:e2").formular1c1 = "=ROUND(RC[-3],2)"
(Dropping the .select line)


Eastar wrote:

A small data base
A B
1 3.3456 6.3535
2 4.5656 10.3265

Want to set up a macro to round the data,Macro as below
Range("d1:e2").Select
Selection.Formula = "ROUND(RC[-3],2)

The result I got is ROUND(RC[-3],2), instead of numbers (3.35, 6.36 .etc.)

thanks


--

Dave Peterson



All times are GMT +1. The time now is 09:53 PM.

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