Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA Problem

I have 35 macros named "Week 1" etc. to "Week 35". Is it possible t
build a macro that will run each macro according to a cell value? i.e
if cell value = 1 it would run "Week 1", if cell value = 23 it woul
run "Week 23". Can anyone help me?
abbevill

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Excel VBA Problem

Sub SelectMacro()
Dim x As Integer
x = ActiveCell.Value
On Error Resume Next
Application.Run ("Week" & x)
On Error GoTo 0
End Sub


Regards,
Greg


-----Original Message-----
I have 35 macros named "Week 1" etc. to "Week 35". Is it

possible to
build a macro that will run each macro according to a

cell value? i.e.
if cell value = 1 it would run "Week 1", if cell value =

23 it would
run "Week 23". Can anyone help me?
abbeville


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Excel VBA Problem

This picks the value from cell B1

Sub Test()
Dim strMacroName
strMacroName = "Week" & CStr(ActiveSheet.Cells(1, 2).Value)
Application.Run (strMacroName)
End Sub

"abbeville " wrote in message
...
I have 35 macros named "Week 1" etc. to "Week 35". Is it possible to
build a macro that will run each macro according to a cell value? i.e.
if cell value = 1 it would run "Week 1", if cell value = 23 it would
run "Week 23". Can anyone help me?
abbeville


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA Problem

Thank You for your help. I tried Greg Wilson's first & it did exactl
what I wanted.

abbevill

--
Message posted from http://www.ExcelForum.com

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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Problem viewing Excel 2003 Pivot Chart fields in Excel 2007 ronny B Charts and Charting in Excel 1 October 24th 08 10:08 PM
Weird problem with Excel 2000...Worksheets disappearing in a shared Excel file BrianL_SF Excel Discussion (Misc queries) 2 October 10th 06 08:27 PM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
Excel 97 chart opened in Excel 2003 - Source Data problem DHunt Charts and Charting in Excel 0 December 6th 04 08:05 PM


All times are GMT +1. The time now is 06:21 PM.

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

About Us

"It's about Microsoft Excel"