R
Ronster
I'm trying to change the defined name string constant using VBA. Is it
possible? Here is my code:
Sub ChangeNameString()
Dim Next_String As String
' this works ok, defined name shows "First_String" (with quotes) (not a
variable)
ActiveWorkbook.Names.Add Name:="MyString", _
RefersToR1C1:="=""First_String"""
Next_String = "Second_String"
' doesn't work when attempting to change name with Next_String varible
(no quotes)
ActiveWorkbook.Names.Add Name:="MyString", _
RefersToR1C1:="=" & Next_String
End Sub
I've tried several variations but nothing works. Any ideas?
possible? Here is my code:
Sub ChangeNameString()
Dim Next_String As String
' this works ok, defined name shows "First_String" (with quotes) (not a
variable)
ActiveWorkbook.Names.Add Name:="MyString", _
RefersToR1C1:="=""First_String"""
Next_String = "Second_String"
' doesn't work when attempting to change name with Next_String varible
(no quotes)
ActiveWorkbook.Names.Add Name:="MyString", _
RefersToR1C1:="=" & Next_String
End Sub
I've tried several variations but nothing works. Any ideas?