LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Delete Named rnage and Add Named Range

My named ranges will be based on changing numbers of rows. I'm trying to
delete a named range (just looping to find all) and re-name the range (for an
eventual import into Access). Below is my code:

Dim nmRange As Name
For Each nmRange In ActiveWorkbook.Names
nmRange.Delete
Next

Sheets("TransposedSheet").Select
Dim LstRow As Long
LstRow = wsTrans.Cells(Rows.Count, "A").End(xlUp).Row

Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Application.Left = 22.75
Application.Top = 100
ActiveWorkbook.Names.Add Name:="SummaryTable", RefersToR1C1:= _
"=TransposedSheet!R1C1:R" & "LstRow" & "C3"
ActiveWorkbook.Names("RyanRange").Comment = ""

Error message is:
Run-time error '1004'
Application-defined or object-defined error

For one thing, the named ranges are NOT being deleted. For another thing,
the code fails on the last line, but I can't figure out why, evening by
F8-ing through the code, the answer isn't apparent to me. So experts, any
ideas?

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
 
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
Named range/cell, sort & delete nc Excel Discussion (Misc queries) 1 July 11th 09 12:55 AM
Delete Hidden Named Range Scott Excel Discussion (Misc queries) 3 July 24th 08 09:40 PM
How do I delete the name for a named range i no longer require? Chris Mitchell Excel Worksheet Functions 2 June 23rd 07 12:38 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Conditionally Delete Cells From Named Range [email protected] Excel Programming 2 September 27th 04 06:21 PM


All times are GMT +1. The time now is 12:30 AM.

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"