Insert Formulas

Marlowwe

New Member
Joined
Jan 12, 2016
Messages
46
Hello,

can you please help me with this macro ?

Need to paste formula with exactly the same formula. Copy cell C2 and paste to cells F2 and F3 as " My type of Formula" with same formula. If you copy and paste Ctr+C a Ctrl+V you will have formula=D2*E2.


ABCDEFG
1Unit priceQ-tyTotal
212=A2*B2=A2*B2
3=A2*B2

<tbody>
</tbody>







Do you know what i mean ? Thank you
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

I know that formula. But I have folmula with 20 cells input and do not want to put $ before cells location.

I copy a cell with formula, select final cell and run the macro.

What macro do:

Paste from copied cell the same Formula (does not matter if has imput from 20cells or only from 2 cells). You can do it maually: Go into cell, select all formula, copy, Go to new cell, paste and click enter
 
Upvote 0
I know that formula. But I have folmula with 20 cells input and do not want to put $ before cells location.
Why do you not want to put $ sign before the cell reference?
you know you can use autofill to extend the formula?
example:
Code:
Set sourceRange = Worksheets("Sheet1").Range("A1:A2") 
Set fillRange = Worksheets("Sheet1").Range("A1:A20") 
sourceRange.AutoFill Destination:=fillRange

if you want same formula then use =$a$2*$b$2

although I have no idea why you would want that ....
 
Last edited:
Upvote 0
The correct approach would have been to construct your file using absolute references but if you're looking for a VBA method to copy/paste formulae, tweak the below code to reference the correct ranges
Code:
Range("B1").Formula = Range("A1").Formula
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,479
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top