Help with simple recorded macro

Deb G.
Lounger
Posts: 46
Joined: 15 Feb 2010, 13:42
Location: Stoney Creek, Ontario, Canada

Help with simple recorded macro

Post by Deb G. »

Hi folks. I'm admittedly not great with this sort of thing. I have a gazillion cells to alter with a formula so I thought recording a macro might save me a bit of time. But it doesn't quite work the way I want.

Here is what I have:

ActiveCell.FormulaR1C1 = "=ROUND(62.13792,2)*1.03"
ActiveCell.Offset(1, 0).Range("A1:C2").Select

What I wanted is for the recording to take the value in the active cell and use that number in the formula as opposed to the value in the cell I recorded. In the recording above, the cell value was 62.13792. However, that number will change with every cell. How do I re-write this to read the active cell value?

User avatar
TonyE
3StarLounger
Posts: 361
Joined: 24 Jan 2010, 14:24
Location: Buckinghamshire, England

Re: Help with simple recorded macro

Post by TonyE »

If you want to multiply the value in the active cell by 1.03, use this:

ActiveCell.Value = ActiveCell.Value * 1.03
Tony

Deb G.
Lounger
Posts: 46
Joined: 15 Feb 2010, 13:42
Location: Stoney Creek, Ontario, Canada

Re: Help with simple recorded macro

Post by Deb G. »

Thank you Tony. Can the ROUND function be included still? In many cases I need to round, then multiple by 1.03.

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Help with simple recorded macro

Post by HansV »

Or:

Code: Select all

    ActiveCell.Formula =ActiveCell.Formula & "*1.03"
Best wishes,
Hans

Deb G.
Lounger
Posts: 46
Joined: 15 Feb 2010, 13:42
Location: Stoney Creek, Ontario, Canada

Re: Help with simple recorded macro

Post by Deb G. »

Thank you Hans.