View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 141
Default Using a macro to populate a cell with a formula

Tom

I am sorry to be a pain but i get the message "Run Time
Error. No Cells were found"

Steve
-----Original Message-----
Dim rng as Range, sForm as String
Dim sStr as String
set rng = Intersect(ActiveSheet.UsedRange, _
Columns(5)).specialCells(xlBlanks)
sStr = rng(1).row
sForm = "=if(A" & sStr & "="""",C" & sStr _
& "+D" & sStr & ","""")"
rng.Formula = sForm

--
Regards,
Tom Ogilvy





"Tom Ogilvy" wrote in message
. ..
Dim rng as Range
set rng = Intersect(ActiveSheet.UsedRange,Columns(1))
rng.offset(0,4).Formula = "=if(A1="""",C1+D1,"""")"

--
Regards,
Tom Ogilvy


"Steve" wrote in

message
...
Hi

I would like to populate column E with a formula

(column C
+ column D) where the the value of Column A is null.

Is this possible ?

Thank you in advance
Steve





.