Error '1004'

K

kittronald

Why does setting the RefersTo value cause a run-time error 1004 ?

Sub Macro_Change_Function()
'
' Macro_Change_Function Macro
'

'
If Sheet2.CheckBoxes("Check Box 23").Value = False Then
Sheet2.CheckBoxes("Check Box 23").Value = True
Else
Sheet2.CheckBoxes("Check Box 23").Value = True
End If

z = Sheets("Settings").Range("XLQ_Functions")
x = GetRefersTo("Fill_Formula")
a = SEARCHFORMULA(z, x)
b = ("xlqh") & Sheets("Settings").Range("Data_Type")
y = Application.Substitute(x, a, b)

ActiveWorkbook.Names("Fill_Formula").RefersTo = y


End Sub



- Ronald K.
 
G

GS

kittronald explained :
Why does setting the RefersTo value cause a run-time error 1004 ?

Sub Macro_Change_Function()
'
' Macro_Change_Function Macro
'

'
If Sheet2.CheckBoxes("Check Box 23").Value = False Then
Sheet2.CheckBoxes("Check Box 23").Value = True
Else
Sheet2.CheckBoxes("Check Box 23").Value = True
End If

z = Sheets("Settings").Range("XLQ_Functions")
x = GetRefersTo("Fill_Formula")
a = SEARCHFORMULA(z, x)
b = ("xlqh") & Sheets("Settings").Range("Data_Type")
y = Application.Substitute(x, a, b)

ActiveWorkbook.Names("Fill_Formula").RefersTo = y


End Sub



- Ronald K.

Debug.Print y to see what it is.
 
K

kittronald

Garry,

Just so everyone knows ... there's a 255 character limit for a name's
Refers to: value.

Of course, ... I already knew that. 8o


- Ronald K.
 
G

GS

Garry,

Just so everyone knows ... there's a 255 character limit for a name's
Refers to: value.

Of course, ... I already knew that. 8o


- Ronald K.

Yes, I know that! I've never tried (via code) to enter anything longer
so are you saying the length exceeded the limit and so the error?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top