View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nikos Yannacopoulos[_5_] Nikos Yannacopoulos[_5_] is offline
external usenet poster
 
Posts: 80
Default Probably an easy one

Indeed an easy one. You need to use a public variable to store the inputted
date value:

Public MyInput
'at the top of the module, before the first Sub or Function

Public Sub GetInput()
MyInput = InputBox("Enter Date")
End Sub

Public Sub Dte()
Selection.Offset(0, 19).Value = MyInput
End Sub

HTH,
Nikos

"carg1" wrote in message
...

Hi, I'm thinking this probably a simple problem, but being a novice it's
eluding me. I have two macros, the first (GetInput()) brings up an
input box into which I enter a date. In the next one (Dte()), I wanted
to take the date that was in the variable from GetInput so I could plug
it in the sheet. I didn't want to merge the two because I don't want
the input box to come up everytime I run the macro. I just want to be
able to get the input box whenever I want to change the date in Dte. I
thought that making both public and GetInput public and static would
work, but it didn't, it gives me no output at all. Can anybody help?

=========================

Public Static Sub GetInput()

Dim MyInput
MyInput = InputBox("Enter Date")
End Sub

=========================

Public Sub Dte()

Dim Dte
Dte = MyInput
Selection.Offset(0, 19) = Dte

End Sub

=========================


--
carg1
------------------------------------------------------------------------
carg1's Profile:

http://www.excelforum.com/member.php...o&userid=15271
View this thread: http://www.excelforum.com/showthread...hreadid=271155