Thread: Call
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Call

Hi Gary,

Yes, you can. Try this and see what happens.

Sub Sheet1()
Debug.Print "this works"
End Sub

Sub test()
Call Sheet1
End Sub

Regards,
Garry
"Gary Keramidas" wrote:

can you even use a reserved name like sheet1 to name a macro?

--


Gary


"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Try

Application.Run ActiveSheet.Name

Tim


"Edmund" wrote in message
...
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)