Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Formula
G'Day Helper
I wish to copy the formula that is in Sheet2 for all colums that contain formula. The lenght of the rows has to be the same as the number of rows in sheet1 and delete, if any, old formula that goes beyond the new rows Thanks Ian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Formula
Sub copyFormula
dim rng as Range Dim cell as Range Dim rng2 as Range, rw as Long set rng2 = worksheets("Sheet1").UsedRange rw = rng2(rng2.count).row set rng = worksheets("Sheet2").cells.SpecialCells(xlFormulas ) for each cell in rng if cell.row <= rw then with worksheets("Sheet1") .range(cell.Address).Formula = cell.formula end with end if Next End Sub -- Regards, Tom Ogilvy would be one interpretation. Make a copy of your workbook and test it on the copy since it overwrites existing data/formulas. Then if it doesn't do what you want, you haven't lost anything. -- Regards, Tom Ogilvy "Ian B" wrote: G'Day Helper I wish to copy the formula that is in Sheet2 for all colums that contain formula. The lenght of the rows has to be the same as the number of rows in sheet1 and delete, if any, old formula that goes beyond the new rows Thanks Ian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel formula to copy/paste formula needed please. | Excel Discussion (Misc queries) | |||
copy formula result (text) only - without copying formula | Excel Discussion (Misc queries) | |||
I copy a formula and the results copy from the original cell | Excel Discussion (Misc queries) | |||
copy formula down a column and have cell references change within formula | New Users to Excel | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) |