Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Prompt User to Select Macro to Run?

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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
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!

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
Prompt User to Select Macro to Run? Patrick Molloy Excel Programming 0 May 15th 09 04:34 PM
Prompt User to Select Macro to Run? Jon Peltier Excel Programming 0 May 15th 09 04:30 PM
Prompt user to select a shape MM User Excel Programming 5 August 19th 08 02:05 PM
How to Prompt a user to select a Folder. Akash Excel Programming 3 July 5th 07 05:02 PM
Prompt user to select a printer using a checkbox within a user Tom Ogilvy Excel Programming 0 January 10th 07 03:57 AM


All times are GMT +1. The time now is 05:08 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"