Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Excel forms And combo boxes

I am setting up a VB form inside an Excel workbook. I have put a Combo box on
the form. My problem is linking the data for the combo box to a column on the
work sheet.
Does any one have an easy to follow example please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Excel forms And combo boxes

Use the following change event for the combobox:

Private Sub ComboBox1_Change()
Worksheets("Sheet1").Range("A1") = ComboBox1.Value
End Sub


Mangesh



"Rob" wrote in message
...
I am setting up a VB form inside an Excel workbook. I have put a Combo box

on
the form. My problem is linking the data for the combo box to a column on

the
work sheet.
Does any one have an easy to follow example please?



  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Excel forms And combo boxes

Thanks for the reply, the answer was similar to what was applied to the VBA,
& was modified acordingly (mainly it was abreviated) but the list box in the
form will not display the range value. It appears I've missed something, I
have tried both options, Data validation & range value either doesn't work.
To be honest as this is a sub form and the range is only aprox. ten (was
only using this option for modification purpose so the form wouldn't need to
be modified in the future only the worksheet). I may do it by check boxes or
command button. Still it would be nice to get the list box going as a need
for it later will be applicable.



"Rob" wrote:

I am setting up a VB form inside an Excel workbook. I have put a Combo box on
the form. My problem is linking the data for the combo box to a column on the
work sheet.
Does any one have an easy to follow example please?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Excel forms And combo boxes

I think I am missing something, you want to populate the combobox with the
values in a range or the other way round...?

My earlier post gave a solution where the combo-box value goes to an excel
cell, for the reverse, you need to do the following:

Private Sub UserForm_Initialize()

ComboBox1.RowSource = "Sheet1!A1:A10"

End Sub

or simply go to the properties and enter
Sheet1!A1:A10
in the rowsource property

Mangesh



"Rob" wrote in message
...
Thanks for the reply, the answer was similar to what was applied to the

VBA,
& was modified acordingly (mainly it was abreviated) but the list box in

the
form will not display the range value. It appears I've missed something, I
have tried both options, Data validation & range value either doesn't

work.
To be honest as this is a sub form and the range is only aprox. ten (was
only using this option for modification purpose so the form wouldn't need

to
be modified in the future only the worksheet). I may do it by check boxes

or
command button. Still it would be nice to get the list box going as a need
for it later will be applicable.



"Rob" wrote:

I am setting up a VB form inside an Excel workbook. I have put a Combo

box on
the form. My problem is linking the data for the combo box to a column

on the
work sheet.
Does any one have an easy to follow example please?



  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Excel forms And combo boxes

Thanks the reply, the info was useful, though didn't use it in the end mainly
because I believe I was trying to get the userform to read into the worksheet
rather than the otherway round which it worked. Now I am stuck again.
In general what I am trying to achieve, is once an item has been selected, a
message box appears for conformation which works, unfortunately if the item
selected is incorrect, is to close the message box and restart from list box,
this sorts of work though it remembers the list box original value which is
is incorrect us aready stated.
Attached is a copy of what was produced, would somebody explain where I have
gone wrong please & wheter I should be using a loop system & wheter stating
the list box values is applicable? Which is actually being read from a
seperate worksheet sheet, also I'd like the message box to only appear once
during conformation.


Sub ListBox1_Click()
MsgBox "You Have Selected_" & ListBox1.Value & "_Do You Wish To Continue?",
vbYesNo
UserForm1.Hide

If MsgBox("Continue?", vbYesNo) < vbYes Then
Call UserForm1_Click

ElseIf ListBox1.Value = "400kV" Then
Call GIS_Voltage1_Sorter

ElseIf ListBox1.Value = "300kV" Then
Call GIS_Voltage1_Sorter

ElseIf ListBox1.Value = "230kV" Then
Call GIS_Voltage1_Sorter

ElseIf ListBox1.Value = "130kV" Then
Call GIS_Voltage_Sorter

ElseIf ListBox1.Value = "66kV" Then
Call GIS_Voltage_Sorter

ElseIf ListBox1.Value = "33kV" Then
Call S33kV_Sorter

ElseIf ListBox1.Value = "11kV" Then
Call S11kV_Sorter

ElseIf ListBox1.Value = "Ancillary" Then
Call Ancillary_Sorter

ElseIf ListBox1.Value = "Master" Then
Call Master_Sorter

End If

Call UserForm1_Click

End Sub


"Rob" wrote:

Thanks for the reply, the answer was similar to what was applied to the VBA,
& was modified acordingly (mainly it was abreviated) but the list box in the
form will not display the range value. It appears I've missed something, I
have tried both options, Data validation & range value either doesn't work.
To be honest as this is a sub form and the range is only aprox. ten (was
only using this option for modification purpose so the form wouldn't need to
be modified in the future only the worksheet). I may do it by check boxes or
command button. Still it would be nice to get the list box going as a need
for it later will be applicable.



"Rob" wrote:

I am setting up a VB form inside an Excel workbook. I have put a Combo box on
the form. My problem is linking the data for the combo box to a column on the
work sheet.
Does any one have an easy to follow example please?



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
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
User Forms - Combo Boxes Michael Excel Dude Excel Discussion (Misc queries) 2 September 3rd 06 10:41 PM
Selecting subsets using combo boxes or list boxes CLamar Excel Discussion (Misc queries) 0 June 1st 06 07:43 PM
Templates/Forms/Boxes in Excel 85225 Excel Discussion (Misc queries) 4 March 24th 06 06:11 PM
Has anyone created forms in Excel with drop down boxes? mcdanik Excel Worksheet Functions 5 November 21st 04 04:04 PM


All times are GMT +1. The time now is 09:39 AM.

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"