Help Me Evaluate This Value In My UserForm

drmingle

Board Regular
Joined
Oct 5, 2009
Messages
229
I am not sure why this is not working, but my objective is to simply evaluate the following:

If Me.Ncb.Value (the value from my userform) is present then
MyIMPBucket = Me.Ncb.Value
MYHCDBucket = Me.Ncb.Value

Code:
Private Sub Ncb_Change()
If (Me.Ncb.Value) Like "*" Then
 
    MyIMPBucket = Me.Ncb.Value
 
    If MyIMPBucket = "Actual charges" Then
        MyIMPBucket = "ImpActl"
        If MyIMPBucket = "B1" Then
        MyIMPBucket = "Implants B1 Dollars"
        If MyIMPBucket = "B2" Then
        MyIMPBucket = "Implants B2 Dollars"
    End If
    End If
    End If
 
End If
If (Me.Ncb.Value) Like "*" Then
 
    MyHCDBucket = Me.Ncb.Value
 
    If MyHCDBucket = "Actual charges" Then
        MyHCDBucket = "DActl"
        If MyHCDBucket = "B1" Then
        MyHCDBucket = "Drugs B1 Dollars"
        If MyHCDBucket = "B2" Then
        MyHCDBucket = "Drugs B2 Dollars"
    End If
    End If
    End If
 
End If
End Sub

Thanks for the help!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Something like this?
Code:
Private Sub Ncb_Change()
    
    Dim MyIMPBucket As String
    Dim MyHCDBucket As String
    
    If Trim(Me.Ncb.Text) <> vbNullString Then
        
        Select Case Trim(Me.Ncb.Text)
            
            Case "Actual charges": MyIMPBucket = "ImpActl"
                                   MyHCDBucket = "DActl"
            
            Case "B1":             MyIMPBucket = "Implants B1 Dollars"
                                   MyHCDBucket = "Drugs B1 Dollars"
            
            Case "B2":             MyIMPBucket = "Implants B2 Dollars"
                                   MyHCDBucket = "Drugs B2 Dollars"
            
        End Select
        
        'Here is where you perform operations with
        'the variables MyIMPBucket and MyHCDBucket
        MsgBox "MyIMPBucket: " & MyIMPBucket & Chr(10) & _
               "MyHCDBucket: " & MyHCDBucket
        
    End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

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