Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well, I recorded a macro but it is not working correctly. It is as followed:

Sub OpenCase1()
'
' OpenCase1 Macro
'

'
    Range("G5").Select
    ActiveCell.FormulaR1C1 = "=R[-4]C[-3]"
    Range("G5").Select
End Sub

It's a simple command, I thought, but obviously it is not working. What I want it to do is, when clicking the macro, it will change cell G5 to =D1, copying the contents of cell D1. From previous help I have gotten, the Select parts in the macro may be a problem, however it might not be the case in this.

All help is rather appreciated, please help :)

share|improve this question
up vote 3 down vote accepted

Simplify the code by accessing the cell directly without Select

Range("G5").Value = "=D1"

or

Range("G5").Formula = "=D1"

or if you want to use your notation for some other reason

Range("G5").FormulaR1C1 = "=R[-4]C[-3]"
share|improve this answer
    
Heh Heh, or I could have done that. Thank you Amer. :) – Mordecaii Apr 23 '13 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .