View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
EricG EricG is offline
external usenet poster
 
Posts: 220
Default Recording Macro - Insert Formula


This may be the problem:

http://support.microsoft.com/kb/212172

HTH,

Eric
---------------------
If toast always lands butter-side down, and cats always land on their feet,
what happen if you strap toast on the back of a cat and drop it?
Steven Wright (1955 - )


"Bythsx-Addagio" wrote:

Excel 2003 VBA
Hi all,
I am attempting to write a macro to insert a formula into a specific cell.
I already have the formula written and working in a normal spreadsheet. I am
just trying to insert it exactly how it is in the same cell of several other
workbooks.

In order to get the syntax correct I tried recording a macro and "cut &
pasting" the formula. Normally this generate the VBA code with the right
syntax to use. However, for this particular formula I am getting an "Unable
to Record" error message. Is there something in the formula that is causing
a problem?? Thanks.

'48 Formula as taken from workbook
'=sum(INDEX(B11:F20,MATCH("Emerging Markets-Investment
Grade",B11:B20,0),MATCH("Net Market Weight
(%)",B11:F11,0)),INDEX(B11:F20,MATCH("Emerging Markets-High
Yield",B11:B20,0),MATCH("Net Market Weight (%)",B11:F11,0)))

Range("D4").Select
'Range("D5").FormulaR1C1 = _
"=SUM(INDEX(B11:F20,MATCH(""Emerging Markets-Investment
Grade"",B11:B20,0),MATCH(""Net Market Weight
(%)"",B11:F11,0)),INDEX(B11:F20,MATCH(""Emerging Markets-High
Yield"",B11:B20,0),MATCH(""Net Market Weight (%)"",B11:F11,0)))"