Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Passing variables from module to userform

Wonder if anyone can help me.

I have an array set up which collects string values. (100 in all)

I'd like to use these values in a userform, but can't work out a way
of getting these values from my code into the userform.

Basically i'd like a form which has the values collected from the
array to be displayed down the left hand side of the form, with a
tick-box to the right of them.

Hope this makes sense to some of you!

Thanks,
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Passing variables from module to userform

Add a listbox to the form

to populate it

For Index = 1 to 100

'''OR
'''For Index = lbound(MyArray,1) to ubound(MyArray,1)

Listbox1.AddItem MyArray(index)
next

set the listbox ListStyle property to frmListStyleOption

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Wonder if anyone can help me.

I have an array set up which collects string values.

(100 in all)

I'd like to use these values in a userform, but can't

work out a way
of getting these values from my code into the userform.

Basically i'd like a form which has the values collected

from the
array to be displayed down the left hand side of the

form, with a
tick-box to the right of them.

Hope this makes sense to some of you!

Thanks,
Chris
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Passing variables from module to userform

Another way to fill a listbox:

UserForm1.ListBox1.List() = arr()


"Chris Dunigan" wrote in message
om...
Wonder if anyone can help me.

I have an array set up which collects string values. (100 in all)

I'd like to use these values in a userform, but can't work out a way
of getting these values from my code into the userform.

Basically i'd like a form which has the values collected from the
array to be displayed down the left hand side of the form, with a
tick-box to the right of them.

Hope this makes sense to some of you!

Thanks,
Chris



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Passing variables from module to userform

Chris -

The problem might be more basic (no pun) than Tim or Patrick have
addressed. The beginning user types

UserForm1.Show

And then wonders how to get information into the form and out of it. At
least this is where I once stumbled.

You should first load the form but not show it, then populate the
various controls as Tim and Patrick describe, then show it. When the
user closes the form, make sure the button code hides it, so it's still
in memory and the main procedure can get the information out. Then if
desired, the main sub can unload the form.

....
Load UserForm1
With UserForm1
' Populate the form's controls
.TextBox1.Text = myValue

' Show the form
.Show

' Extract from the form
myNewValue = .TextBox1.Text
End With
Unload UserForm1
....

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______


Chris Dunigan wrote:

Wonder if anyone can help me.

I have an array set up which collects string values. (100 in all)

I'd like to use these values in a userform, but can't work out a way
of getting these values from my code into the userform.

Basically i'd like a form which has the values collected from the
array to be displayed down the left hand side of the form, with a
tick-box to the right of them.

Hope this makes sense to some of you!

Thanks,
Chris


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Passing variables from module to userform

Thanks guys,

It was a very simple problem of not declaring a public variable,
therefore the code couldn't pick up the macro values. I was obviously
not all there yesterday!!

Thanks again,
Chris



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
VBA - passing Variables to subroutines Madduck Excel Discussion (Misc queries) 12 September 19th 08 03:20 AM
Passing Variables Jeff Excel Discussion (Misc queries) 1 November 4th 05 06:46 PM
VBA passing variables through a function Jeff Excel Discussion (Misc queries) 2 November 3rd 05 11:23 PM
Passing Variables Royce[_2_] Excel Programming 1 November 20th 03 02:16 PM
Passing a value to a variable from Userform Neal Steiner Excel Programming 1 July 18th 03 09:12 PM


All times are GMT +1. The time now is 06:47 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"