![]() |
combo box
I wrote an If statement to drive the list fill range of a combo box. It
worked till I added the second if now my result is alwats "ratelookup". Can anyone figure out what I messed up on the syntax ? Thanks, Yosef Private Sub ComboBox3_GotFocus() If Range("b2").Value = "Alt A Second" Then ComboBox3.ListFillRange = "ratelookups" If Range("b2").Value = "Alt A+ Second" Then ComboBox3.ListFillRange = "ratelookup2" Else: ComboBox3.ListFillRange = "ratelookup" End If End If End Sub |
combo box
Try adding an "ELSE:" before the second IF statement, like this:
ComboBox3.ListFillRange = "ratelookups" Else: If Range("b2").Value = "Alt A+ Second" Then HTH, Elkar "ynissel" wrote: I wrote an If statement to drive the list fill range of a combo box. It worked till I added the second if now my result is alwats "ratelookup". Can anyone figure out what I messed up on the syntax ? Thanks, Yosef Private Sub ComboBox3_GotFocus() If Range("b2").Value = "Alt A Second" Then ComboBox3.ListFillRange = "ratelookups" If Range("b2").Value = "Alt A+ Second" Then ComboBox3.ListFillRange = "ratelookup2" Else: ComboBox3.ListFillRange = "ratelookup" End If End If End Sub |
combo box
Thanks - perfect !
Stupid mistake and screwed me for half a day !! "Elkar" wrote: Try adding an "ELSE:" before the second IF statement, like this: ComboBox3.ListFillRange = "ratelookups" Else: If Range("b2").Value = "Alt A+ Second" Then HTH, Elkar "ynissel" wrote: I wrote an If statement to drive the list fill range of a combo box. It worked till I added the second if now my result is alwats "ratelookup". Can anyone figure out what I messed up on the syntax ? Thanks, Yosef Private Sub ComboBox3_GotFocus() If Range("b2").Value = "Alt A Second" Then ComboBox3.ListFillRange = "ratelookups" If Range("b2").Value = "Alt A+ Second" Then ComboBox3.ListFillRange = "ratelookup2" Else: ComboBox3.ListFillRange = "ratelookup" End If End If End Sub |
All times are GMT +1. The time now is 04:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com