Formula via Offset() exact not relative

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

Excel 2003


The formula below works but it copies the formula exactly as the cell above.

myCell.Formula = myCell.Offset(-1, 0).Formula

Thus, A5 = B5+C5 and A6 =B5+C5 (if the formula above populates A6)

How can I copy a preceding Cell formula yet have it relative (A6=B6+C) ?

TIA Dennis
 
One way:

With myCell.Offset(-1, 0)
.AutoFill .Resize(2, 0), xlFillDefault
End With
 
Thanks for your knowledge & time.

I substituted the formula in the following:


If myCell.Offset(-1, 0).HasFormula Then
' myCell.Formula = myCell.Offset(-1, 0).Formula
With myCell.Offset(-1, 0)
.AutoFill .Resize(2, 0), xlFillDefault
End With
Else
myCell.Formula = myCell.Offset(-1, 0).Value
End If

The problem is that no auto fill copy is done. No error
message is displayed. Any thoughts?

TIA Dennis
 
There *should* have been an error message.

Try

.AutoFill .Resize(2, 1), xlFillDefault

instead.
 
Still not working and no error message?

Dennis

JE McGimpsey said:
There *should* have been an error message.

Try

.AutoFill .Resize(2, 1), xlFillDefault

instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top