Offset inside formula code

fabriciofcmiranda

Board Regular
Joined
Jun 27, 2006
Messages
62
I have this code:

Code:
    Range("projectname").Offset(-1, 0).Select
    ActiveCell.FormulaR1C1 = "=completename"
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

The fact is I need to transform the "completename" into "completename.Offset(-1, 0)", since the cell I need to reffer to is the one right above "completename", that changes each time I insert a new line. But I can't figure out a way to transform this into a valid code. Can anyone help me?

Thank you very much!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Or maybe:

Code:
ActiveCell.Formula = "=" & Range("completename").Offset(-1, 0).Address(False,False)
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,547
Or even:
Code:
ActiveCell.Value= Range("completename").Offset(-1, 0).Value
 

Forum statistics

Threads
1,136,272
Messages
5,674,753
Members
419,525
Latest member
helensesc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top