I am creating a group of interactive excel forms
They are all in one workbook, but the coding is extensive with many VBA objects on each sheet
some of the sheets have over 25 pages of code
I am also using named ranges for any cell references scoped to individual worksheets to enable copying of the sheets and insertion of rows
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
> </o
>
I get this error whenever I open the workbook and there are any values set for the objects
<o
> </o
>
Run-time error ‘1004’:
Selected method of Range class failed
<o
> </o
>
Here is a sample section of code where I get an error
<o
> </o
>
Private Sub ComboBox8_Change()
'Unprotect sheet
Call UnlockSheet
<o
> </o
>
'Lock display to speed up
Application.ScreenUpdating = False
<o
> </o
>
'Clear Cell Contents and Borders and Lock
'Contents
Range("SFRACLabel1,SFRACLabel2,SFRACLabel3,SFRACLabel4").Select
Selection.ClearContents
<o
> </o
>
<o
> </o
>
<o
> </o
>
The error occurs where the named ranges come in “SFRACLabel…”
<o
> </o
>
When each sheet is selected the code runs fine
But it appears that when the workbook is opened it runs all the code from all the sheets and thus only one sheet will be selected
<o
> </o
>
Solution A. is there any way to stop excel from running this code at open
<o
> </o
>
Solution B. is there any way to activate each sheet and allow the code to run
(I tried using a FOR loop already in the workbook open section to sequentially activate each sheet and it didn’t work)
<o
> </o
>
Any help would be appreciated.
<o
> </o
>
Thanks,
JJohanni<o
></o
>
They are all in one workbook, but the coding is extensive with many VBA objects on each sheet
some of the sheets have over 25 pages of code
I am also using named ranges for any cell references scoped to individual worksheets to enable copying of the sheets and insertion of rows
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com




I get this error whenever I open the workbook and there are any values set for the objects
<o


Run-time error ‘1004’:
Selected method of Range class failed
<o


Here is a sample section of code where I get an error
<o


Private Sub ComboBox8_Change()
'Unprotect sheet
Call UnlockSheet
<o


'Lock display to speed up
Application.ScreenUpdating = False
<o


'Clear Cell Contents and Borders and Lock
'Contents
Range("SFRACLabel1,SFRACLabel2,SFRACLabel3,SFRACLabel4").Select
Selection.ClearContents
<o


<o


<o


The error occurs where the named ranges come in “SFRACLabel…”
<o


When each sheet is selected the code runs fine
But it appears that when the workbook is opened it runs all the code from all the sheets and thus only one sheet will be selected
<o


Solution A. is there any way to stop excel from running this code at open
<o


Solution B. is there any way to activate each sheet and allow the code to run
(I tried using a FOR loop already in the workbook open section to sequentially activate each sheet and it didn’t work)
<o


Any help would be appreciated.
<o


Thanks,
JJohanni<o

