Hi, I'm attempting to name a particular cell, based on a string.This gives me extra apostrophes around CellName. eg:Code:Dim CellName As String Dim extendedName As String ' Somewhere CellName has been set, eg CellName = "H25" ActiveWorkbook.Names.Add Name:="Total", RefersToR1C1:= _ "='Report 5'!" & CellName
Total ='Report 5'!'H25'
So I tried defining the whole string first:However, this then added quotation marks around the entire formula, eg:Code:extendedName = "'Report 5'!" & CellName ActiveWorkbook.Names.Add Name:="Total", RefersToR1C1:= extendedName
Total ="'Report 5'!H25"
Does anyone know how to do this? It seems like I'm overlooking something really simple.




Reply With Quote