Author Topic: Moar VBA macroage!  (Read 628 times)

Moar VBA macroage!
« on: 13 October, 2011, 11:56:37 am »
I've been struggling with this for a little while now, and I can't find Tim who usually solves my problems ( :-[ ), and the internet in general is being useless.

I have a super-clever macro which (amongst other things) pastes formulae into cells. What I want to do is modify the formula below, so that when the macro pastes it in the cell, it retains the cell references in the formula:

"=IF(ISNA(VLOOKUP(CONCATENATE(" & """G""" & "," & FormulaCell.Offset(0, -20) & "),'[communicationsheet.xls]IA - NB'!A$7:BV$252,74,FALSE))," & """Input estimate""" & ", VLOOKUP(CONCATENATE(" & """G""" & "," & FormulaCell.Offset(0, -20) & "),'[communicationsheet.xls]IA - NB'!A$7:BV$252,74,FALSE))"

 At the moment it gives "...(CONCATENATE("G",44456)..."* - I want it to return "(CONCATENATE("G",C4)" (or C5, or C6, and so on. Column C, row-that-I-am-in. You know what I mean).

I believe this can be done using R1C1 cell references (I think that's the term for them), but I don't know how to use them, and every time I Google, all I find is loads of clever-clogs saying "Use "offset" - it's much simpler". And I've asked everyone in my group who can write VBA, and they all said "R1C1? No, I prefer "offset". Why don't you use that?"

*weeps*

So, non-offset-related solutions gratefully accepted, ta.

 :)

*44456 being the value in cell C4
Have you seen my blog? It has words. And pictures! http://ablogofallthingskathy.blogspot.com/

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Moar VBA macroage!
« Reply #1 on: 13 October, 2011, 01:24:04 pm »
Try using FormulaCell.Offset(0, -20).formula?

Re: Moar VBA macroage!
« Reply #2 on: 13 October, 2011, 02:38:42 pm »
Try using FormulaCell.Offset(0, -20).formula?

FormulaCell.Offset(0, -20).address seems to do the trick! :thumbsup:

Ta.  :)
Have you seen my blog? It has words. And pictures! http://ablogofallthingskathy.blogspot.com/