Thread: Call
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Edmund Edmund is offline
external usenet poster
 
Posts: 62
Default Call

Hi There,

Macro should recornize my "TargettedActiveSheet" as the active sheet openned
in Excel. The active sheet's name should be returned & set as
"TargettedActiveSheet" so that my macro call use this returned name to call
the correct procedure that is intended to work on the active sheet.

So, if the active sheet name is Sheet1, then "TargettedActiveSheet" should
return Sheet1 as the reference for macro. If Sheet99 is the active sheet,
then "TargettedActiveSheet" should return Sheet99 so that Macro can recognize
the right name in order to invoke CALL the the sub procedure named "Sheet99"
so as to execute code & work out the macro I intended for Sheet99 or Sheet1
or any other active sheet.

How can I use make Macro do this? I tried the below but to no avail.

Sub Identify_And_Optimize_Target_File()
Dim TargettedActiveSheet As String
TargettedActiveSheet = ActiveWorkbook.ActiveSheet.Name
Call TargettedActiveSheet
End Sub


Private Sub Sheet1()
'Do as I intend for sheet1
End Sub


Private Sub Sheet99()
'Do as I intend for sheet99
End Sub

Thanks a lot

--
Edmund
(Using Excel XP)