ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selective call procedure (https://www.excelbanter.com/excel-programming/278567-selective-call-procedure.html)

JamesA

Selective call procedure
 

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.

Nikos Yannacopoulos[_2_]

Selective call procedure
 
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.


-----Original Message-----

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.
.


Jan Karel Pieterse

Selective call procedure
 
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

-----Original Message-----

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.
.



All times are GMT +1. The time now is 01:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com