Go Back   Access World Forums > Apps and Windows > Excel

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 03-02-2018, 02:16 AM   #1
raghuprabhu
Newly Registered User
 
Join Date: Mar 2008
Posts: 152
Thanks: 43
Thanked 6 Times in 6 Posts
raghuprabhu is on a distinguished road
Combo box with two columns.

I have two columns in the combo box in my form.
How do I make the data from the second column populate the worksheet?

It is possible in Access, but not in Excel?

Please look at the attached file.

Thanks

Regards
Raghu
Attached Files
File Type: zip ComboBoxes.zip (21.6 KB, 23 views)

raghuprabhu is offline   Reply With Quote
Old 03-02-2018, 02:56 AM   #2
Gasman
Access newbie
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 2,273
Thanks: 287
Thanked 346 Times in 331 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Combo box with two columns.

Change the bound column to 2 ?
__________________
Access novice. Sometimes trying to give something back.
Access 2007
Gasman is online now   Reply With Quote
The Following User Says Thank You to Gasman For This Useful Post:
raghuprabhu (03-02-2018)
Old 03-02-2018, 03:24 AM   #3
ridders
Part time moderator
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 6,153
Thanks: 83
Thanked 1,515 Times in 1,415 Posts
ridders is just really nice ridders is just really nice ridders is just really nice ridders is just really nice ridders is just really nice
Re: Combo box with two columns.

This is mainly an Access forum
You might do better posting at e.g. Mr Excel forum instead

Anyway, assuming it's the same as Access, combo box columns are zero based so the 2nd column is Column(1)

Reference this on your user form as Me.MyComboBoxName.Column(1)

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

New example databases:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

-----------------------------------------------------------------------------------
nil illegitimi carborundum est
ridders is offline   Reply With Quote
The Following User Says Thank You to ridders For This Useful Post:
raghuprabhu (03-02-2018)
Old 03-02-2018, 12:53 PM   #4
raghuprabhu
Newly Registered User
 
Join Date: Mar 2008
Posts: 152
Thanks: 43
Thanked 6 Times in 6 Posts
raghuprabhu is on a distinguished road
Re: Combo box with two columns.

Thanks,

Gasman and Ridders. I have come to know that the combo boxes don't the same in Excel.

Have to do two cascading combo boxes

I have learnt to sort it out.

Regards
Raghu
raghuprabhu is offline   Reply With Quote
Old 03-02-2018, 02:07 PM   #5
Gasman
Access newbie
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 2,273
Thanks: 287
Thanked 346 Times in 331 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Combo box with two columns.

Well for the benefit of anyone else who needs to do the same or similar, at least say how you solved it.

Quote:
Originally Posted by raghuprabhu View Post
Thanks,

Gasman and Ridders. I have come to know that the combo boxes don't the same in Excel.

Have to do two cascading combo boxes

I have learnt to sort it out.

Regards
Raghu
__________________
Access novice. Sometimes trying to give something back.
Access 2007
Gasman is online now   Reply With Quote
Old 03-02-2018, 06:45 PM   #6
raghuprabhu
Newly Registered User
 
Join Date: Mar 2008
Posts: 152
Thanks: 43
Thanked 6 Times in 6 Posts
raghuprabhu is on a distinguished road
Re: Combo box with two columns.

My apologies!

I found the solution at this site..

http://www.excel-easy.com/vba/exampl...mbo-boxes.html

Code:
Private Sub CommandButton1_Click()
Dim RowCount As Long
Dim benefits, total As Single
If Me.txtName.Value = "" Then
MsgBox "Please enter a name", vbExclamation, "Employee Data"
Me.txtName.SetFocus
End If
'Range("A5") = txtName.Text
If Not IsNumeric(Me.txtSalary.Value) Then
MsgBox "The Amount box must contain a number.", vbExclamation, "Employee Data"
Me.txtSalary.SetFocus
End If
'Range("B5") = txtSalary.Value
benefits = txtSalary.Value * 0.5
'Range("C5") = benefits
total = txtSalary.Value + benefits
'Range("D5") = total
RowCount = Worksheets("Sheet2").Range("A4").CurrentRegion.Rows.Count
With Worksheets("Sheet2").Range("A4")
.Offset(RowCount, 0) = Me.txtName.Value
.Offset(RowCount, 1) = Me.ComboBox1.Value
.Offset(RowCount, 2) = Me.ComboBox1.Column(1) '<<<<<<< this is my soloution
.Offset(RowCount, 3) = Me.txtSalary.Value
.Offset(RowCount, 4) = benefits
.Offset(RowCount, 5) = total
End With
End Sub


Last edited by raghuprabhu; 03-02-2018 at 06:47 PM. Reason: amending my message..
raghuprabhu is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill text box based on combo box (no using columns in combo box!) SirStevie3 Forms 1 05-21-2014 12:26 PM
Add 2 columns to Combo box bconner Excel 0 09-12-2012 07:46 AM
Combo box with 4 columns spcepickle Forms 5 04-24-2008 11:58 PM
Combo Box w/ 2 columns triscuit83 Forms 4 01-25-2007 10:45 AM
Combo box with 2 columns mcgooie Forms 5 09-21-2006 08:31 AM




All times are GMT -8. The time now is 08:04 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World