Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Pause a macro after each line, run next after hitting spacebar?

I want the following macro to stop after each line and wait for me to hit the
spacebar before entering the next line. What code do I need to add?

Sub Optimize()
'
' Optimize Macro
' Run through series of percentages
'
' Keyboard Shortcut: Ctrl+Shift+O
'
Application.Run "PERSONAL.XLS!MoveCursorNot"
ActiveCell.FormulaR1C1 = "0.0001"
ActiveCell.FormulaR1C1 = "0.0002"
ActiveCell.FormulaR1C1 = "0.0003"
ActiveCell.FormulaR1C1 = "0.0004"
ActiveCell.FormulaR1C1 = "0.0005"
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Pause a macro after each line, run next after hitting spacebar?

There is no way to pause a macro and wait for a keypress. The
only thing you can do is display a MsgBox after each line of code
and let the user click OK.


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


"manxman" wrote in message
...
I want the following macro to stop after each line and wait for
me to hit the
spacebar before entering the next line. What code do I need to
add?

Sub Optimize()
'
' Optimize Macro
' Run through series of percentages
'
' Keyboard Shortcut: Ctrl+Shift+O
'
Application.Run "PERSONAL.XLS!MoveCursorNot"
ActiveCell.FormulaR1C1 = "0.0001"
ActiveCell.FormulaR1C1 = "0.0002"
ActiveCell.FormulaR1C1 = "0.0003"
ActiveCell.FormulaR1C1 = "0.0004"
ActiveCell.FormulaR1C1 = "0.0005"
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Pause a macro after each line, run next after hitting spacebar?

Of course, hitting the space bar clicks the OK button,
so this does do what the OP wants ;)

Chip Pearson wrote:
There is no way to pause a macro and wait for a keypress. The
only thing you can do is display a MsgBox after each line of code
and let the user click OK.


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


"manxman" wrote in message
...
I want the following macro to stop after each line and wait for
me to hit the
spacebar before entering the next line. What code do I need to
add?

Sub Optimize()
'
' Optimize Macro
' Run through series of percentages
'
' Keyboard Shortcut: Ctrl+Shift+O
'
Application.Run "PERSONAL.XLS!MoveCursorNot"
ActiveCell.FormulaR1C1 = "0.0001"
ActiveCell.FormulaR1C1 = "0.0002"
ActiveCell.FormulaR1C1 = "0.0003"
ActiveCell.FormulaR1C1 = "0.0004"
ActiveCell.FormulaR1C1 = "0.0005"
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Pause a macro after each line, run next after hitting spacebar

That sounds like it would be fine. How do you suggest I proceed to make this
as simple as possible? Thanks very much for your help.

"Chip Pearson" wrote:

There is no way to pause a macro and wait for a keypress. The
only thing you can do is display a MsgBox after each line of code
and let the user click OK.


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


"manxman" wrote in message
...
I want the following macro to stop after each line and wait for
me to hit the
spacebar before entering the next line. What code do I need to
add?

Sub Optimize()
'
' Optimize Macro
' Run through series of percentages
'
' Keyboard Shortcut: Ctrl+Shift+O
'
Application.Run "PERSONAL.XLS!MoveCursorNot"
ActiveCell.FormulaR1C1 = "0.0001"
ActiveCell.FormulaR1C1 = "0.0002"
ActiveCell.FormulaR1C1 = "0.0003"
ActiveCell.FormulaR1C1 = "0.0004"
ActiveCell.FormulaR1C1 = "0.0005"
End Sub




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
How can I create a new line in a cell in Excel by hitting enter? Monica Excel Discussion (Misc queries) 4 July 1st 05 06:32 PM
hitting spacebar in excel deletes last character entered. badgercat New Users to Excel 0 March 14th 05 09:47 PM
Pause a Macro? Jimbo Excel Programming 2 October 14th 04 04:21 AM
excel macro - macro initiation upon hitting the ener key arunjoshi[_2_] Excel Programming 1 April 28th 04 09:58 PM
Pause during a Macro Marie[_3_] Excel Programming 6 January 18th 04 12:18 PM


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