define names

ehsas

Board Regular
Joined
Sep 17, 2002
Messages
200
I have more than 20 columns in my excel file which i need to define as name.Currently I have to select each column manually and then define as name.Is there any way where column heading be selected as defaulted name.Regards,
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Albert 1

Active Member
Joined
Feb 22, 2002
Messages
393
If the columns you want to name are consecutive, you can use this macro.
First: type in A1, B1, C1,...etc. the names, then run the macro:

Sub Macro1()
x = 1
Do While Cells(1, x)<> ""
ActiveWorkbook.Names.Add Name:=Cells(1, x), RefersToR1C1:="=Sheet1!R2C" & x & ":R100C" & x
x = x + 1
Loop
End Sub

Note: If the first cell used by the macro (in my example A1) is blank, the macro doesn't work.
This message was edited by albert 1 on 2002-10-12 08:31
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
On 2002-10-12 05:38, ehsas wrote:
I have more than 20 columns in my excel file which i need to define as name.Currently I have to select each column manually and then define as name.Is there any way where column heading be selected as defaulted name.Regards,

Are these columns contiguous?

Do they change (expand/crimp) in concert?

Which column is of numeric type?

These questions are meant to assess whether you can define one (or two) names that refer to data in these columns.
 

ehsas

Board Regular
Joined
Sep 17, 2002
Messages
200
Are these columns contiguous? no

Do they change (expand/crimp) in concert? no

Which column is of numeric type? no numeric all are text
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209

ADVERTISEMENT

On 2002-10-12 07:20, ehsas wrote:
Are these columns contiguous? no

Do they change (expand/crimp) in concert? no

Which column is of numeric type? no numeric all are text

If the columns ranges are of equal size and the date they hold are related, you still can define a single name for the whole bunch. The INDEX function can then be used to access the individual columns. Maybe this isn't worth the effort...
 

ehsas

Board Regular
Joined
Sep 17, 2002
Messages
200
I have done another way I have selected all the columns where i need to define as name and choosed insert-name-create and select the top row and it created the names for the column.Please advise if it is correct way of doing.

Regards,
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
On 2002-10-12 10:40, ehsas wrote:
I have done another way I have selected all the columns where i need to define as name and choosed insert-name-create and select the top row and it created the names for the column.Please advise if it is correct way of doing.

Regards,

That's OK. You can check each name from the Name Box to see whether it references the appropriate range.
 

Forum statistics

Threads
1,143,739
Messages
5,720,578
Members
422,292
Latest member
Bernd0501

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top