View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Prompt User to Select Macro to Run?

I posted too much data. Some of the code was from another equest

Sub SelectMacros()

Results = InputBox("Type 1 to run macro ABC" & vbCrLf & _
"Type 2 to run macro DEF" & vbCrLf & _
"Type 3 to run macro GHI" & vbCrLf & _
"Type 4 to run macro JKL" & vbCrLf)

Select Case Results
case 1 call ABC
case 2 call DEF
case 3 call GHI
case 4 call JKL
End Select

End Sub


"joel" wrote:

Sub ImportRatedData()
'
' ImportRatedData Macro
' Macro recorded 5/13/2009 by innesh
'
' Keyboard Shortcut: Ctrl+i
'
Dim RatedHeaderCopy
Dim RatedRowCopy As Integer
Dim RatedRowPaste As Integer
Dim ActiveTab

RatedHeaderCopy = "A1:A7"
FolderName = "c:\temp"

Set FSO = CreateObject _
("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder(FolderName)

Set destbk = Workbooks("4K_Data_for_Limit_Modification.xls")


For Each sf In Folder.subfolders
FName = Dir(sf.Name & "\" & "Rated.dat")
FName = Dir(sf.Path & "\" & "*.txt")
If FName < "" Then

' ActiveTab = "DDEC"
' RatedRowCopy = 10
' RatedRowPaste = 14
Workbooks.OpenText Filename:=sf.Path & "\" & FName
Set Databk = ActiveWorkbook

Set DestSht = destbk.Sheets(Right(Range("A7"), 4))
With DestSht
RatedRowPaste = .Range("A65536").End(xlUp).Row + 1

' Range("A3").Select

.Range(RatedHeaderCopy).Copy _
Destination:=DestSht.Range("A" & RatedRowPaste)
.Range("E" & RatedRowCopy, "ER" & RatedRowCopy).Copy
DestSht.Range("H" & RatedRowPaste).PasteSpecial _
Paste:=xlPasteValues
End With
Databk.Close savechanges:=False
End If

Next sf
destbk.Close savechanges:=True
End Sub


Sub SelectMacros()

Results = InputBox("Type 1 to run macro ABC" & vbCrLf & _
"Type 2 to run macro DEF" & vbCrLf & _
"Type 3 to run macro GHI" & vbCrLf & _
"Type 4 to run macro JKL" & vbCrLf)

Select Case Results
case 1 call ABC
case 2 call DEF
case 3 call GHI
case 4 call JKL
End Select

End Sub


"SeventhFloorProfessor" wrote:

Is it possible to have a macro run that prompts the user to select which
macro to run? If so, how would that be coded?

The situation:

I am creating a workbook that will guide the user to create a "template"
(not as a literal file, but in the sense that this will be the starting
workbook), which the user will be prompted to save as another file name (this
will be their personal template for their class). Since I am creating this
for teachers who are not familiar with macros, I would like to store the
various macros I have written in one workbook, and then prompt the user to
select which macro to run, depending on what they want to do...

help!