View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SeanEvans SeanEvans is offline
external usenet poster
 
Posts: 1
Default Variables From TextBoxes


I am trying to capture a variant using a TextBox for use later on in
seperate Macro. The first part of the macro works fine and captures th
data I require but it seems to lose the variable later on.

I use a Form with 3 TextBoxes to capture 3 dates - date1, date2, date3
Upon clicking the OK button (CommandButton1) the contents of th
textboxes are "transfered" to variables date1, date2, date3 - as see
below.


Public Sub CommandButton1_Click()
Dim date1, date2, date3 As Variant

date1 = TextBox1
date2 = TextBox2
date3 = TextBox3

Unload UserForm1


End Sub

Then I wish to run the following code to return these dates vi
keypresses no data is returned.

Sub Fkeyson()

Application.OnKey "{F10}", "doDate1"
Application.OnKey "{F11}", "doDate2"
Application.OnKey "{F12}", "doDate3"

End Sub

Sub Fkeysoff()

Application.OnKey "{F10}"
Application.OnKey "{F11}"
Application.OnKey "{F12}"
End Sub

Sub doDate1()

MsgBox (date1)
ActiveCell.Value = date1

End Sub

What do I need to do to carry the variables over from one macro t
another ?

Thanks in advance

--
SeanEvan
-----------------------------------------------------------------------
SeanEvans's Profile: http://www.excelforum.com/member.php...fo&userid=1465
View this thread: http://www.excelforum.com/showthread.php?threadid=26385