View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Range - copy forumlas

Sub AddFormula()
Dim rng as Range, cell as Range
On error resume next
set rng = range("Simon").SpecialCells(xlBlanks)
On error goto 0
if not rng is nothing then
for each cell in rng
cell.formula = Range("A1").formula
' or Range("A1").Copy cell
Next
End if
end Sub

--
Regards,
Tom Ogilvy


"sgrech" wrote in
message ...

Hi I have a defined cell range(called simon) which currently covers cell
A35 to A40. The size of the range can expand / contract depending on
whether rows ae inserted / deleted. The cell the range starts can also
alter.

My problem is where I insert a new role within the defined cell range
as the formulas disappear. I need to re-instate these formulas prior
to the spreadheet being closed.

Therefore what I would like to do is run a macro which which will copy
a forumula (probably stored inn cell A1) and copy and paste this to the
each cell on the defined range, either it can paste formula in each
cell, or if the macro is really clever it will only paste the formula
in any empty cells within the range.

Your help with this will be much appreciated.

Regards
Simon


--
sgrech
------------------------------------------------------------------------
sgrech's Profile:

http://www.excelforum.com/member.php...o&userid=14501
View this thread: http://www.excelforum.com/showthread...hreadid=526256