Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I have user form return a value when the form closes
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way is with a public variable. You have to change the userform type from
private to public. Then declare a vailble in the VBA module window outside you other functions and subroutines. "Suhas" wrote: How can I have user form return a value when the form closes |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Create a Public variable in the userform's code module and set that variable
when you close the form. E.g., "Suhas" wrote in message ... How can I have user form return a value when the form closes |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Create a Public variable in the userform's code module and set that variable
when you close the form. E.g., Public ReturnValue As Long Private Sub btnClose_Click() Me.ReturnValue = 123 Me.Hide End Sub Then, read the variable in the form with code right after you Show the form: Sub ShowForm() Dim Res As Long UserForm1.Show vbModal Res = Userorm1.ReturnValue Unload Userform1 MsgBox CStr(Res) End Sub -- Cordially, Chip Pearson Microsoft Most Valuable Professional - Excel Pearson Software Consulting, LLC www.cpearson.com (email on web site) "Suhas" wrote in message ... How can I have user form return a value when the form closes |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Programming | New Users to Excel | |||
New to Programming | Excel Programming | |||
Programming to VBE | Excel Programming | |||
Programming lag | Excel Programming | |||
Programming lag.. | Excel Programming |