Combo Month Text link as number

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,287
Office Version
  1. 2013
Platform
  1. Windows
Hello,
ComboBox ListFillRange is base on month text,
If I select the month of January from combo I want that month number will linked to call AP2 as month.
Is there any code for combobox change function?
Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
So if you select January in the combobox, you want to put a 1 in cell AP2 ? Is that what you are asking?

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] ComboBox1_Change()
    [color=darkblue]With[/color] Me.ComboBox1
        [color=darkblue]If[/color] .ListIndex > -1 [color=darkblue]Then[/color]
            Range("AP2").Value = .ListIndex + 1
        [color=darkblue]Else[/color]
            Range("AP2").Value = ""
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Upvote 0
Thank you:)
Here is another Change event procedure that you can consider...
Code:
[table="width: 500"]
[tr]
	[td]Private Sub ComboBox1_Change()
  Range("AP2").Value = Mid(ComboBox1.ListIndex + 1, 1 - (ComboBox1.Value = ""))
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,112
Messages
6,189,039
Members
453,521
Latest member
Chris_Hed

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