Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default renaming excel data lists

Excel 2003 has the Data/Lists/Create Lists functionality. Creating
lists is no problem, but I'm at a loss as to renaming any lists I
create. Excel automatically names the lists in the file as 1, 2, 3...
It would be nice to be able to rename them as desired.

I've been using a workaround of adding a named range over the top of
the list.

example: ActiveWorkbook.Names.Add Name:="AddressList",
RefersToR1C1:= range

Obviously, this is clumsy. Is there a better way?

so how do I change

Set rng = ws.ListObjects(1).ListColumns(3).Range

to something like

Set rng = ws.ListObjects("AddressList").ListColumns
(3).Range


Art
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default renaming excel data lists

With a list of your desired names in H1:H10

Sub Rename_Lists()
Dim lst As ListObject
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("H1")
For Each lst In ActiveSheet.ListObjects
lst.Name = rng.Offset(i, 0).Value
i = i + 1
Next lst
Exit Sub
endit:
MsgBox "there is a List by that name, re-type a name"
End Sub

To rename just a single List.

Sub rename_one_list()
ActiveSheet.ListObjects("List1").Name = "AddressList"
End Sub


Gord Dibben MS Excel MVP


On Fri, 6 Nov 2009 10:47:47 -0800 (PST), c1802362 wrote:

Excel 2003 has the Data/Lists/Create Lists functionality. Creating
lists is no problem, but I'm at a loss as to renaming any lists I
create. Excel automatically names the lists in the file as 1, 2, 3...
It would be nice to be able to rename them as desired.

I've been using a workaround of adding a named range over the top of
the list.

example: ActiveWorkbook.Names.Add Name:="AddressList",
RefersToR1C1:= range

Obviously, this is clumsy. Is there a better way?

so how do I change

Set rng = ws.ListObjects(1).ListColumns(3).Range

to something like

Set rng = ws.ListObjects("AddressList").ListColumns
(3).Range


Art


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default renaming excel data lists

Thanks!

On Nov 6, 3:03*pm, Gord Dibben <gorddibbATshawDOTca wrote:
With a list of your desired names in H1:H10

Sub Rename_Lists()
Dim lst As ListObject
* Dim rng As Range
* Dim i As Integer
* On Error GoTo endit
* * * Set rng = Range("H1")
* * * For Each lst In ActiveSheet.ListObjects
* * * lst.Name = rng.Offset(i, 0).Value
* * * i = i + 1
* * * Next lst
* * * Exit Sub
endit:
* MsgBox "there is a List by that name, re-type a name"
End Sub

To rename just a single List.

Sub rename_one_list()
ActiveSheet.ListObjects("List1").Name = "AddressList"
End Sub

Gord Dibben *MS Excel MVP



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default renaming excel data lists

You're welcome.

Gord

On Fri, 6 Nov 2009 13:29:55 -0800 (PST), c1802362 wrote:

Thanks!

On Nov 6, 3:03*pm, Gord Dibben <gorddibbATshawDOTca wrote:
With a list of your desired names in H1:H10

Sub Rename_Lists()
Dim lst As ListObject
* Dim rng As Range
* Dim i As Integer
* On Error GoTo endit
* * * Set rng = Range("H1")
* * * For Each lst In ActiveSheet.ListObjects
* * * lst.Name = rng.Offset(i, 0).Value
* * * i = i + 1
* * * Next lst
* * * Exit Sub
endit:
* MsgBox "there is a List by that name, re-type a name"
End Sub

To rename just a single List.

Sub rename_one_list()
ActiveSheet.ListObjects("List1").Name = "AddressList"
End Sub

Gord Dibben *MS Excel MVP



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
Renaming Data... cdavidson Excel Discussion (Misc queries) 2 March 14th 07 03:14 AM
Deleting or Renaming Lists Tail Wind Excel Discussion (Misc queries) 0 February 4th 06 08:22 PM
Deleting or Renaming Lists Max Excel Discussion (Misc queries) 2 February 4th 06 08:03 PM
renaming data labels by different cells than source data Darren Charts and Charting in Excel 4 January 12th 06 10:35 AM
Excel Data Validation Lists Cameron_S Excel Programming 3 April 13th 05 01:52 PM


All times are GMT +1. The time now is 04:42 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"