Combo box to display in label

anthonfire

New Member
Joined
Oct 9, 2006
Messages
3
Hi im doing a payroll program and i need to get a label to display the payrate for people listed in the combo box. Both the payrate and employee name are linked from the excel sheet. So when a different name is selected from the list the label changes the payrate. Any ideas?

cheers
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi Anthonfire

Welcome to the board

what column is the employee name in, and what column is the payrate in?
I assume you are using a userform

N
 
Upvote 0
Code:
Private Sub ComboBox1_Change()
    Label1.Caption = Range(ComboBox1.RowSource).Offset(0, 6).Cells(ComboBox1.ListIndex + 1)
    End Sub

If you are using a userform, paste in this code and it will hopefully work (untested)

n
 
Upvote 0
tried it

Thanks for that.
I tried

Private Sub cboEmployeeName_Change()
lblPayRate.Caption = Range(cboEmployeeName.RowSource).Offset(0, -1).Cells(cboEmployeeName.ListIndex + 6)

It didnt work, I may have done it wrong. Could i send it to you and you could have a look?

Appreciate the help.
 
Upvote 0
Neil,

I'd be interested in how this was resolved. I've been playing with something close to this.

I'd appreciate it.

Thanks,

Dean
 
Upvote 0
Hi Dean

the code I posted did the job - the problem was that the combobox was being populated not using the rowsource property. Once that was altered it seemed to be working ok

N
 
Upvote 0
Thanks Anthony and Neil for your responses. This is extremely helpful. Saves me a lot of hair. :biggrin: Have a nice day.

Dean
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top