#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default define name

Selection.CurrentRegion.Select
Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:=False

The above code define the names of the top colums in my selection - but it
does that for the wotksheet level - I will need to have that define locally
for the sheet only.

Any idea?

M
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default define name

It doesn't look like there's an option that allows you to make the names local.

But you could do it with something like:

Option Explicit
Sub testme01()

Dim myRng As Range
Dim myCol As Range

Set myRng = Selection.CurrentRegion

For Each myCol In myRng.Columns
With myCol
.Resize(.Rows.Count - 1, 1).Offset(1, 0).Name _
= "'" & .Parent.Name & "'!" & .Cells(1).Value
End With
Next myCol

End Sub




mark wrote:

Selection.CurrentRegion.Select
Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:=False

The above code define the names of the top colums in my selection - but it
does that for the wotksheet level - I will need to have that define locally
for the sheet only.

Any idea?

M


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default define name

Thank you

Option Explicit
Sub testme01()

Dim myRng As Range
Dim myCol As Range

Set myRng = Selection.CurrentRegion

For Each myCol In myRng.Columns
With myCol
.Resize(.Rows.Count - 1, 1).Offset(1, 0).Name _
= "'" & .Parent.Name & "'!" & .Cells(1).Value
End With
Next myCol

End Sub




mark wrote:

Selection.CurrentRegion.Select
Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:=False

The above code define the names of the top colums in my selection - but it
does that for the wotksheet level - I will need to have that define locally
for the sheet only.

Any idea?

M


--

Dave Peterson

Reply
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
Define a Value sagenichole Excel Worksheet Functions 2 May 18th 10 02:41 PM
Define name davesexcel[_49_] Excel Programming 0 March 9th 06 01:19 AM
Name Define Ken Johnston Excel Discussion (Misc queries) 6 January 8th 06 03:04 PM
define name sunshine Excel Discussion (Misc queries) 1 March 29th 05 01:37 AM
Name define Alexander[_4_] Excel Programming 3 December 31st 03 02:16 PM


All times are GMT +1. The time now is 08:20 AM.

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

About Us

"It's about Microsoft Excel"