Concatenation Problem


Posted by Herb B. on November 07, 2001 11:51 AM

The following are the first few lines of a macro that I am writing:

Sub NameRanges()
Dim NameMark As String
Dim PanelName As String
Dim RangeName As String
NameMark = "_"
PanelName = Sheets("Panels").Range("AE13").Value
RangeName = "NameMark&PanelName"
ActiveWorkbook.Names.Add Name:=RangeName, RefersToR1C1:="=Panels!R13C27:R52C50"

What I am trying to do is add an underscore to the Value in cell "AE13" so that it is part of the Range Name. I get the error message that "That name is not Valid". I know that the underscore is alright to use in a range name because I have done it before. Also, the Value in range "AE13" is a valid range name, and finally putting both of them together is a valid range name. I am assuming the statement RangeName = "NameMark&PanelName" is incorrect.



Posted by Barrie Davidson on November 07, 2001 11:58 AM

Just change it to read

RangeName = NameMark & PanelName

Regards,
BarrieBarrie Davidson