View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Macro asking for input

You could use an InputBox. There are 2 different ones , one is from excel
(Application.ImputBox) , the other one is from vba (InputBox). The first one
is , i believe, more interesting as you tell what kind of value you ask for :
Sub test()
Dim res As String
res = Application.InputBox("Select a range", "My Input", , , , , , 2)
'above, the last param 2 means we ask for a String
If res = "False" Then Exit Sub 'user clicked cancel
'else continue to process
MsgBox "you have entered: " & res
End Sub

Check the online help to get more input on how to use it (ask the user to
select a range, to enter a number, ...)

Regards,
Sebastien
"jerry chapman" wrote:

How can I write a macro that asks for and read a user supplied date?