First i don't know if this will be right forum but i know its related somehow?
I'm using excel developer visual basic and i have a combobox

Dim x As String
Dim y As String

    x = "O15"           ' range


With ComboBox1

    If .Text = "" Then
        Range(x) = ""
    ElseIf .Text = "Level 4" Then
        Range(x) = "12%"
        Range("CountLevel4") = Range("CountLevel4") + 1
    ElseIf .Text = "Level 5" Then
        Range(x) = "50%"
        Range("CountLevel5") = Range("CountLevel5") + 1
    ElseIf .Text = "Level 6" Then
        Range(x) = "100%"
        Range("CountLevel6") = Range("CountLevel6") + 1
    ElseIf .Text = "Level 7" Then
        Range(x) = "100%"
        Range("CountLevel7") = Range("CountLevel7") + 1
    ElseIf .Text = "Lost" Then
        Range(x) = "0%"
        Range("CountLost") = Range("CountLost") + 1
    End If

my code is that everytime the combo box change its text it will add + 1 to a specific Column
my problem is let say that the combobox is a level 4 then i change it to level 5 i want it to deduct 1 to level 4 and add it 1 to level 5.

Recommended Answers

All 3 Replies

You might want to consider using .SelectedText instead of .Text, if .Text isn't giving you the right result.

can you give an example?

With ComboBox1
    If .SelectedText = "" Then
    Range(x) = ""
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.