CWalsh87
Technical User
- Dec 15, 2010
- 16
Hi,
I need to insert a function into cells using VBA. For various reasons i need a variable in the function so i've used the following code:
For a = 1 to 10
activesheet.range("D1100").select
Selection.FormulaR1C1 = "=IF(ISERROR(SEARCH('Product Type'!D" & a & ",rc[1],1)),"""",'Product Type'!D" & a &")"
Next a
The forumula is inserted into the correct cells, but reads as follows:
=IF(ISERROR(SEARCH('Product Type'!'D10',F6,1)),"",'Product Type'!'D10')
As you can see the D10 has extra ' marks placed around it, therefore returning #NAME? error.
Has anyone any ideas??
Cheers
Chris
I need to insert a function into cells using VBA. For various reasons i need a variable in the function so i've used the following code:
For a = 1 to 10
activesheet.range("D1100").select
Selection.FormulaR1C1 = "=IF(ISERROR(SEARCH('Product Type'!D" & a & ",rc[1],1)),"""",'Product Type'!D" & a &")"
Next a
The forumula is inserted into the correct cells, but reads as follows:
=IF(ISERROR(SEARCH('Product Type'!'D10',F6,1)),"",'Product Type'!'D10')
As you can see the D10 has extra ' marks placed around it, therefore returning #NAME? error.
Has anyone any ideas??
Cheers
Chris