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: 32
Default trouble adding a name...

When I open a workbook, I have code to check all of the worksheets to see if
they have already been "formatted", if not I run code to do so... (new
worksheets are added to the workbook by an external program, and need to be
reformatted into a legible worksheet)
A range name is added to each worksheet to flag it as having been
reformatted (ReformattingComplete = True...) The new sheets do not have the
name; it is added by code (which is where i might be having my problem....

On a new sheet, with no range named (ReformattingComplete) it gets stuck in
an endless loop at the error handler...

any suggestions would be much appreciated,
mark


Private Sub Workbook_Open()
For Each Sheet In Worksheets
If Sheet.Name < "QuickBooks Export Tips" _
And Sheet.Name < "Billing Rates" _
And Sheet.Name < "Project Upset" Then
Worksheets(Sheet.Name).Activate
ReformatWorksheet 'call subroutine to verify formatting
status
End If
Next Sheet
End Sub

------------------------------------------------
Sub ReformatWorksheet()
On Error GoTo errNoNameFound ' new sheets will not have a named range
"ReformatingCompleted"
If ActiveWorkbook.ActiveSheet.Names("ReformatingCompl eted").Value =
"=TRUE" Then
Exit Sub
End If
FormatandAddFormulas 'subrouting to reformat sheet is called
....
errNoNameFound: ' Error-handling routine
ActiveWorkbook.ActiveSheet.Names.Add Name:="ReformatingCompleted",
RefersToR1C1:=False 'add named reange and assign false value


 
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
trouble adding addins jc Excel Discussion (Misc queries) 0 December 23rd 09 12:15 AM
trouble adding addins jc Excel Discussion (Misc queries) 0 December 23rd 09 12:13 AM
Trouble with VB since adding a macro Susan Excel Programming 1 April 11th 06 05:13 PM
trouble adding to list. jeramie[_2_] Excel Programming 2 March 13th 06 08:31 AM
I am having trouble adding a row in Excel. What am i doing wrong? Glendie Excel Worksheet Functions 1 May 28th 05 08:37 PM


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