LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Multiple range names

Sub AddNames()
Dim rng As Range, rng1 as Range, cell as Range
With Workbooks("Test.xls").Worksheets("Master Data")
Set rng = .Range(.Cells(1, 1), .Cells(1, 63))
End With
For Each cell In rng
Set rng1 = rng.Offset(1, 0).Resize(6999, 1)
ThisWorkbook.Names.Add Name:=cell, _
RefersTo:="=" & rng1.Address(1, 1, xlA1, external:=True)
Next
End Sub

--
Regards,
Tom Ogilvy


"Madiya" wrote:

Hi Tom,
You are always quick and kind to me. Thanks.
One more question.
How can I use it to create names in other workbook?

for e.g.
='[TEST.xls]Master Data'!$B$2:$B$7000

Regards,
Madiya

Tom Ogilvy wrote:

One way:

Dim rng as Range
set rng =Range(cells(1,1),Cells(1,63))
for each cell in rng
rng.offset(1,0).Resize(6999,1).Name = cell.Text
Next

another

Range(A1:BK7000).CreateNames Top:=True, _
Left:=False, Bottom:=False, Right:=False

--
Regards,
Tom Ogilvy

--
Regards,
Tom Ogilvy



"Madiya" wrote:

I want to create range names from column A to BK and from 2 to 7000
rows with name as text in the first cell in the respective column.
I know how to create a name for one column but for so many columns I am
struck.

Can any one guide me please?

Regards,
Madiya.




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get range names to Apply across multiple tabs TrippKnightly Excel Worksheet Functions 1 August 10th 11 03:48 PM
delete multiple range names mnsue Excel Discussion (Misc queries) 8 January 18th 10 10:41 PM
Named Range: Same Names, Multiple Workbooks with Same Sheet Name BEEJAY Excel Discussion (Misc queries) 4 November 7th 08 03:19 PM
Semi-automating the generation of multiple cell range names SJKopischke Excel Discussion (Misc queries) 4 June 23rd 06 06:04 PM
Dynamic range names, multiple criteria, sumproduct [email protected] Excel Discussion (Misc queries) 1 September 20th 05 02:58 AM


All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"