Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Deedee
 
Posts: n/a
Default User to decide how often a macro runs

Can anyone help...Please.... I need a macro that asks for the user to input
the number of times it needs to run. Thanks for any help in advance
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default User to decide how often a macro runs

Try something like the following:

Dim NumRuns As Long
Dim Ndx As Long
NumRuns = Application.InputBox(prompt:="Enter number of times.",
_
Type:=1)
For Ndx = 1 To NumRuns
' run your macro code here
Next Ndx


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Deedee" wrote in message
...
Can anyone help...Please.... I need a macro that asks for the
user to input
the number of times it needs to run. Thanks for any help in
advance



  #3   Report Post  
Harald Staff
 
Posts: n/a
Default User to decide how often a macro runs

One way among several:

Sub test()
Dim L As Long, X As Long
L = Application.InputBox("Pick a number:", Type:=1)
For X = 1 To L
Call SubProc(X, L)
Next
End Sub

Sub SubProc(L As Long, LMax As Long)
MsgBox "Yo da man !", vbExclamation, L & " of " & LMax
End Sub

HTH. Best wishes Harald

"Deedee" skrev i melding
...
Can anyone help...Please.... I need a macro that asks for the user to

input
the number of times it needs to run. Thanks for any help 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
I want a macro to save a workbook as a user inputted cell EAHRENS Excel Discussion (Misc queries) 3 November 8th 05 03:28 PM
Macro for user to input 10 numbers Deedee New Users to Excel 4 October 21st 05 07:44 PM
macro that brings user to cell based on "yes/no" response lennyx2 Excel Discussion (Misc queries) 2 February 9th 05 02:47 PM
Links in formulas change when another user runs a workbook L Mehl Excel Discussion (Misc queries) 2 November 27th 04 09:27 PM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


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