Selective call procedure

J

jamesa

Sub WSheetOctW3()
'
' WSheetMaster Macro
' Macro recorded 01/10/2003 by sbtp00220
'
Call FormatMainWSheet
Call ColorPMMD01
Call ColorPMMD02
Call ColorPMMD03
End Sub

I want to apply the above macros to different workshhets.
On some of them not all the modules apply.
How can I avoid the debug error message where a call does
not apply on a worksheet.
 
N

Nikos Yannacopoulos

Try this:
Sub WSheetOctW3()
'
' WSheetMaster Macro
' Macro recorded 01/10/2003 by sbtp00220
' On Error Resume Next
Call FormatMainWSheet
Call ColorPMMD01
Call ColorPMMD02
Call ColorPMMD03 On Error GoTo 0
End Sub

The first error handling statement results error-producing
lines being skipped, the second one resets error handling
to default.

Nikos Y.
 
J

Jan Karel Pieterse

Hi,

Not sure if this is what you need:

Sub WSheetOctW3()
'
' WSheetMaster Macro
' Macro recorded 01/10/2003 by sbtp00220
'
If Activesheet.Name="Joe" then
Call FormatMainWSheet
End If
If Activesheet.Name="Joe" Or Activesheet.Name="John"
then
Call ColorPMMD01
End If
Call ColorPMMD02
Call ColorPMMD03
End Sub


Regards,

Jan Karel Pieterse
Excel TA/MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top