Monday, 15 August 2011

excel - VBA: Set Range Name with String variable -


I am having an issue that seems simple, but I do not know what is the problem with my code

  Long as long as y, y as long as the name of the long retarded name in the form of the name string y = cell (1, 1). End (xlToRight). Column Y contract name for X = 1 = cell (1, x) z = cell (lines coat, x). End (XLEP). Set RangeTown = Category (Cell (2, X), Cell (z, x)) RangeToName.Name = ContractName Next x and all  

Trying to name the categories in the cell based on the text, which will change for every x.

But the "RangeToName.Name = ContractName" line gives me a run-time 450 error.

However if I add any other text to that line, for example " Ranjitnam. Name = "Test" and Contract Name "Everything works and my categories are named after the full string of text in which the" Contract name "cell ...

What do I remember? Used to be?

Cheers

A name must start with a letter or underscore, empty in it No space and should not be similar to the reserved keyword in Excel.

In other words:

One name can not start with a digit.

A name can not be "This is an exam"

For example "KL2000" is not usable as a name because cell reference will be in conflict with KL2000 . But "_KL2000" will be usable.

You should try directly from the Excel application directly, what you will do with VBA. If you did this with the name "KL 2000", then you've got a meaningful error message.


No comments:

Post a Comment