Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
trouble adding addins | Excel Discussion (Misc queries) | |||
trouble adding addins | Excel Discussion (Misc queries) | |||
Trouble with VB since adding a macro | Excel Programming | |||
trouble adding to list. | Excel Programming | |||
I am having trouble adding a row in Excel. What am i doing wrong? | Excel Worksheet Functions |