View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default pausing a macro to input cell contents

Pause for input........................

Sub getuserinput()
'some of your code goes here
usrinput = InputBox("enter a number")
Range("A1").Value = usrinput
'resume rest of code
End Sub

Or if you want to select a cell or range to operate on...........

Sub selectit()
'your code
Set srng = Application.InputBox(prompt:= _
"Select a Range of cells", Type:=8)
'do something with srng
End Sub

Combination of the two above into one...............

Sub selectit()
usrinput = InputBox("enter a string")
Set srng = Application.InputBox(prompt:= _
"Select a Range of cells", Type:=8)
For Each cell In srng
cell.Value = usrinput
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 12 Jan 2009 16:38:06 -0800, blipityblap
wrote:

My first macro using XP, Excel 2003.

During the Recording of a macro, what syntax/keystroke is required to
'pause' a macro so as to allow input of data into a cell address, and then
re-initate continuance of the macro to its next step? I do not want to end
or stop the macro, just pause it automatically to enter data.