boim
Board Regular
- Joined
- Dec 14, 2009
- Messages
- 54
According to Excel Help, the arguments of CreateNames method are optional:
yet I found that even after I specify one, in VBA, Excel STILL guesses for the text labels. This happens only when the values are texts.
So for example, I have two columns range, say "A:B". "A" contains text for the Names and "B" contains text for formulas:
A_________B
Speed_____Distance / Time
Accel______Speed / Time
etc...
I created names in VBA:
and it didn't work. Excel will guess sometimes the first row to be labels too and sometimes the last row, eventhough I'd already specified Left:=True. I had to specify all other arguments to False to get it right. Is this a bug? Again, it doesn't happen if "B" contains numbers.
Remarks
If you don’t specify one of Top, Left, Bottom, or Right, Microsoft Excel guesses the location of the text labels, based on the shape of the specified range.
yet I found that even after I specify one, in VBA, Excel STILL guesses for the text labels. This happens only when the values are texts.
So for example, I have two columns range, say "A:B". "A" contains text for the Names and "B" contains text for formulas:
A_________B
Speed_____Distance / Time
Accel______Speed / Time
etc...
I created names in VBA:
Code:
Range("A1:B5").CreateNames Left:=True
and it didn't work. Excel will guess sometimes the first row to be labels too and sometimes the last row, eventhough I'd already specified Left:=True. I had to specify all other arguments to False to get it right. Is this a bug? Again, it doesn't happen if "B" contains numbers.