Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Macro asking for input

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


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Macro asking for input

Range("B5").Formula = InputBox("Enter Date")
works for me.

"jerry chapman" wrote in message
.. .
How can I write a macro that asks for and read a user supplied date?




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
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 05:23 AM
Input Box within a macro McCloudK Excel Discussion (Misc queries) 3 September 28th 07 09:31 PM
Macro Data Input rbiggs Excel Discussion (Misc queries) 10 December 10th 06 11:09 PM
input box within macro Drummy Excel Worksheet Functions 1 June 7th 06 09:38 AM
pause for input during macro rmills Excel Programming 1 January 29th 04 05:24 AM


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