Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Named ranges disappearing in Excel 2007

I have some named ranges (no more than 15) in a workbook and I am assigning
their values to string variables. For some reason my named ranges
are randomly disappearing after my code runs.

The syntax in VBA looks like this:

strDate = Worksheets("SheetName").Range("NamedRange1").Value

Any ideas?????

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Named ranges disappearing in Excel 2007

Are you deleting the cells of the named range somewhere in your code? The
named range will refer to 'Worksheet Name'!#REF! after the delete, and will
be invalid the next time you try to use it.

You will have to step through all of your code to figure out where this is
happening.

You might consider including an error hander and doing it like this:

Public Sub Test()
Dim rngNamedRange As Range

On Error Resume Next

Set rngNamedRange = ThisWorkbook.Names("NamedRange").RefersToRange

If rngNamedRange Is Nothing _
Then
MsgBox "'NamedRange' has disappeared!", vbCritical + vbOKOnly
Else
'Continue processing.
End If
End Sub

--
Regards,
Bill Renaud



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Named ranges disappearing in Excel 2007

In article ,
Mike wrote:

I have some named ranges (no more than 15) in a workbook and I am
assigning their values to string variables. For some reason my named
ranges are randomly disappearing after my code runs.


I have seen this happen recently, but only once. I don't know whether
the disappearance was related to code running or not.

--
David J Richardson --
http://davidj.richardson.name/ - Dr Who articles/interviews/reviews
http://www.boomerang.org.au/ - Boomerang Association of Australia
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
Excel 2007 Named Ranges Barb Reinhardt Excel Discussion (Misc queries) 0 September 22nd 08 08:01 PM
Named Ranges Disappearing in Excel 2007 Mike H. Excel Discussion (Misc queries) 6 April 29th 08 05:36 PM
Named ranges disappearing in Excel 2007 Mike Excel Discussion (Misc queries) 0 December 18th 07 08:09 PM
Named ranges in Excel 2007 [email protected] Excel Discussion (Misc queries) 2 September 10th 07 08:22 PM
Excel 2007 Beta-Named Ranges reno Excel Discussion (Misc queries) 4 June 26th 06 09:33 PM


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