LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Pass variable from user form to macro

I'm using a user form to get a selection from a customer, which I then will
place in a cell in the worksheet. How do I pass this selection from the user
form to the controlling sub?

Sub PopulateListWithShingleTypeRange()
'Shingle Type Selection
Dim Selection As String
Dim ShingleSeletion As String
For Each x In Sheet1.Range("StblShingleType")
UserForm1.ListBox1.AddItem x.Value
Next
UserForm1.Caption = "Shingle Selection"
With UserForm1.Label1
' Set the text of the label.
.Caption = "Select the Shingle Type"
End With
UserForm1.Show
Range("InptShingleType").Value = Selection
UserForm1.Hide
End Sub

I've tried declaring a variable with the same name in the user form, but
that didn't work either. Thanks.
 
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
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
Help w/ macro to run user form GMet Excel Programming 2 September 7th 04 07:12 PM
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM
Calling variable from user form Geraldon Excel Programming 2 February 9th 04 03:18 PM


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