View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Starting A Macro

Are you sure that you really need 52 macros instead of having one using the
Week No as parameter? In the latter case this event sub does the job (say
cell for inputting week No is A1)

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "A1" Then
Call weekmacro(Target.Value)
End If
End Sub

Regards,
Stefi
Sub weekmacro(weekno)
MsgBox "macro" & weekno
End Sub


zephyr ezt *rta:

This week is week # 45.

I have 52 macros on a worksheet. Each one selects data for a particular week
when a button is pressed. I would like to eliminate the buttons and have the
macro start when the particular week# is typed in the cell.

If a particular week # is typed in a cell how do I get the macro to start
for the week number selected. The week number may range from 1 to 52.

Many thanks in advance.