View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keiji kounoike keiji kounoike is offline
external usenet poster
 
Posts: 199
Default update excel form macro


If the field A is the Combobox named as ComboBox1, the field B named as
ComboBox2 and the field C named as ComboBox3.
Something like this is what you are looking for?

Private Sub ComboBox3_Enter()
If ComboBox1.Value < ComboBox2.Value Then
Me.ComboBox3.List = Array("Discrepancy")
Else
Me.ComboBox3.Clear
End If
End Sub

As you said, you could use StrComp Function to compare two texts. In
that case, your code would be like

If StrComp(ComboBox1.Value, ComboBox2.Value) < 0 Then

instead of

If ComboBox1.Value < ComboBox2.Value Then

Keiji

sam wrote:
I have an excel form with existing macros that I need to update.

The idea is to auto populate one field based on values selected in two other
fields.

Lets say there are 3 fields A, B, C with specific values listed as a drop
down menu.

A: Hello, What, Going, There
B: Did, Jolly, Cool, Tomorrow
C: Discrepancy

so lets say for eg, If Hello and Did are selected, C will remain blank

If Hello, Jolly are selected, C will populate Discrepancy
(assume Hello has lower rating then Jolly)

If What and Did are selected, C will remain blank.

The Idea is, values in A and B column are text values and they have ratings.

If value in A has lower rating then value in B then populate 'discrepancy'
in C
If value in A has higher rating then value in B then no value is populated
in C
If A and B have the same values then no value is populated in C

And so on.. I hope it is clear.

Thanks in Advance