View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Pass Variable Question

Initially hide the userform rather than unload it.

Sub Macro()
UserForm1.Show
fltDate = UserForm1.txtDate.Value
Unload Userform1
end sub

Private CommandButton_click()
msgbox (fltDate) *** The msgbox is blank ***
me.hide
end sub

--
Regards,
Tom Ogilvy


"SyrHoop" wrote in message
...
I have a simple form that I load, it asks for a date. It has a submit
button. I want to be able to use that date after the submit button is
clicked. How do I go about doing that in VBA?

Sub Macro()
UserForm.Show
fltDate = UserForm.txtDate.Value
end sub

Private CommandButton_click()

msgbox (fltDate) *** The msgbox is blank ***

end sub

Thanks in advance