Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Transfer Variable from Form to Module

I am having problems transferring a variable from a form back to a module.
My module is:

Public invP, vP
Sub Mod()
..
..
UserForm6.Show
MsgBox invP & vP
..
end sub

Private Sub CommandButton1_Click()
..
invP = ListBox1.ListIndex + 1
vP = ListBox2.ListIndex + 1
..
end sub

In the routine CommandButton1 invP=1 and vP=3
when the control returns to the routine Mod they both equal zero.
Any ideas why and how to make them behave?
  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Transfer Variable from Form to Module

I imagine you have already checked this, but is anything in the listbox? If
so, has anything been selected before clicking the button?

--
JNW


"Gleam" wrote:

I am having problems transferring a variable from a form back to a module.
My module is:

Public invP, vP
Sub Mod()
.
.
UserForm6.Show
MsgBox invP & vP
.
end sub

Private Sub CommandButton1_Click()
.
invP = ListBox1.ListIndex + 1
vP = ListBox2.ListIndex + 1
.
end sub

In the routine CommandButton1 invP=1 and vP=3
when the control returns to the routine Mod they both equal zero.
Any ideas why and how to make them behave?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Transfer Variable from Form to Module

Thank you for the ideas - code for cancel button had been duplicated in code
for OK button - so code was setting to zero!

"JNW" wrote:

I imagine you have already checked this, but is anything in the listbox? If
so, has anything been selected before clicking the button?

--
JNW


"Gleam" wrote:

I am having problems transferring a variable from a form back to a module.
My module is:

Public invP, vP
Sub Mod()
.
.
UserForm6.Show
MsgBox invP & vP
.
end sub

Private Sub CommandButton1_Click()
.
invP = ListBox1.ListIndex + 1
vP = ListBox2.ListIndex + 1
.
end sub

In the routine CommandButton1 invP=1 and vP=3
when the control returns to the routine Mod they both equal zero.
Any ideas why and how to make them behave?

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
Transfer variable to user Form jlclyde Excel Discussion (Misc queries) 2 April 23rd 10 08:25 PM
Access variable from form and module? parkin_m Excel Programming 1 August 8th 07 03:32 PM
Unload A Form based on a Variable in my Module [email protected] Excel Programming 4 May 2nd 07 11:11 PM
Transfer control to new module in macro BrianG[_4_] Excel Programming 2 October 20th 03 09:50 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 03:29 PM.

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

About Us

"It's about Microsoft Excel"