#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Starting A Macro

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Starting A Macro

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

--
HTH

Bob Phillips

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

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



  #3   Report Post  
Posted to microsoft.public.excel.misc
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Macro - Return to starting cell sony654 Excel Worksheet Functions 8 February 26th 06 08:55 PM
Macro for cell selection starting with Last Cell Valerie Excel Worksheet Functions 4 December 9th 05 08:25 PM
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM


All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"