Starting A Macro

G

Guest

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

Bob Phillips

Application.Run "macro_" & Range("A1").Value

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Guest

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:
 

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

Similar Threads


Top