Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel formula to copy/paste formula needed please. colwyn Excel Discussion (Misc queries) 4 October 22nd 08 11:27 PM
copy formula result (text) only - without copying formula Mulberry Excel Discussion (Misc queries) 2 October 2nd 08 09:51 AM
I copy a formula and the results copy from the original cell brooklynsd Excel Discussion (Misc queries) 1 June 23rd 07 01:35 AM
copy formula down a column and have cell references change within formula brad New Users to Excel 5 May 13th 07 04:38 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"