Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Probably an easy one


Hi, I'm thinking this probably a simple problem, but being a novice it'
eluding me. I have two macros, the first (GetInput()) brings up a
input box into which I enter a date. In the next one (Dte()), I wante
to take the date that was in the variable from GetInput so I could plu
it in the sheet. I didn't want to merge the two because I don't wan
the input box to come up everytime I run the macro. I just want to b
able to get the input box whenever I want to change the date in Dte.
thought that making both public and GetInput public and static woul
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

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

--
carg
-----------------------------------------------------------------------
carg1's Profile: http://www.excelforum.com/member.php...fo&userid=1527
View this thread: http://www.excelforum.com/showthread.php?threadid=27115

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



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
Easy one for you all... Connie Martin Excel Worksheet Functions 5 October 31st 09 08:58 AM
How to sum in an easy way? [email protected] Excel Discussion (Misc queries) 7 April 20th 06 02:38 PM
Easy one pkbro Excel Worksheet Functions 1 August 5th 05 05:01 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
OMG! This seems to easy I can't get it John Gittins Excel Programming 1 August 5th 03 09:23 PM


All times are GMT +1. The time now is 07:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"