Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically create names from values in cell
Dear Experts:
This simple code snippet automatically creates names from values in the left column of a selection Sub CreateNames() Selection.CreateNames Left:=True End Sub The built-in functionality is: Formulas - Create from Selection - Create names from values in the left column. For the macro solution to work, one must select cells from at least two columns. Hence this simple macro should be re-written so that the current selection of cells ( cells have been selected from just one column) automatically gets extended to the right. For example: Current selection A2:A5. The code snippet for the extension of the selection should extend the selection to A2:B5. Help is much appreciated. Thank you very much in advance. Regards, Andreas |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically create names from values in cell
I wouldn't use CreateNames as the macro name -- it looks way too much like the
..CreateNames method for a range. Option Explicit Sub MyCreateNames() Selection.Columns(1).Resize(, 2).CreateNames Left:=True End Sub The .columns(1) tells excel to just look at the first column in the selection. The .resize(, 2) tells excel to include the adjacent column. On 07/17/2010 14:18, andreashermle wrote: Dear Experts: This simple code snippet automatically creates names from values in the left column of a selection Sub CreateNames() Selection.CreateNames Left:=True End Sub The built-in functionality is: Formulas - Create from Selection - Create names from values in the left column. For the macro solution to work, one must select cells from at least two columns. Hence this simple macro should be re-written so that the current selection of cells ( cells have been selected from just one column) automatically gets extended to the right. For example: Current selection A2:A5. The code snippet for the extension of the selection should extend the selection to A2:B5. Help is much appreciated. Thank you very much in advance. Regards, Andreas -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically create names from values in cell
On 17 Jul., 22:00, Dave Peterson wrote:
I wouldn't use CreateNames as the macro name -- it looks way too much like the .CreateNames method for a range. Option Explicit Sub MyCreateNames() * * *Selection.Columns(1).Resize(, 2).CreateNames Left:=True End Sub The .columns(1) tells excel to just look at the first column in the selection. The .resize(, 2) tells excel to include the adjacent column. On 07/17/2010 14:18, andreashermle wrote: Dear Experts: This simple code snippet automatically creates names from values in the left column of a selection Sub CreateNames() * Selection.CreateNames Left:=True End Sub The built-in functionality is: Formulas - Create from Selection - Create names from values in the left column. For the macro solution to work, one must select cells from at least two columns. Hence this simple macro should be re-written so that the current selection of cells ( cells have been selected from just one column) automatically gets extended to the right. For example: Current selection A2:A5. The code snippet for the extension of the selection should extend the selection to A2:B5. Help is much appreciated. Thank you very much in advance. Regards, Andreas -- Dave Peterson- Zitierten Text ausblenden - - Zitierten Text anzeigen - Hi Dave, thank you very much for your greate support. Regards, Andreas |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to create worksheet names based on the values in the selectedrange | Excel Programming | |||
Use Cell Values to Create Tabs with specific names | Excel Programming | |||
How to create table of cell names with the name's cell address | Excel Discussion (Misc queries) | |||
Bubbble chart -How to automatically add series names, X, Y values | Charts and Charting in Excel | |||
Concatenating cell values to create sheet names | Excel Discussion (Misc queries) |