Multiple Case statements

davidausten

New Member
Joined
Sep 1, 2017
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
Im using a combo box to select the option. The thing I am having trouble with is that if you select the second case statement from the list (they are in this order in the combo box) it selects I2 and not I3. totally stumped.

VBA Code:
Private Sub ComboBox1_Change()
With ComboBox1

Select Case Decide

Case Me.ComboBox1.Value = "Flat_Payment"

Sheet1.Range("I2").Copy

Case Me.ComboBox1.Value = "Duplicate_Payment_Invoice"

Sheet1.Range("I3").Copy

Case Me.ComboBox1.Value = "Duplicate_Payment_Statement"

Sheet1.Range("I4").Copy

Case Me.ComboBox1.Value = "Tax"

Sheet1.Range("I5").Copy

Case Me.ComboBox1.Value = "Dispute_Tax"

Sheet1.Range("I6").Copy

Case Me.ComboBox1.Value = "Courtesy_Adjustment"

Sheet1.Range("I7").Copy

Case Me.ComboBox1.Value = "Added_Payment_to_Misdirected"

Sheet1.Range("I8").Copy

Case Me.ComboBox1.Value = "Transfer_Portion_of_Payment"

Sheet1.Range("I9").Copy

Case Me.ComboBox1.Value = "Transfer_Payment_Auto_Lockbox"

Sheet1.Range("I10").Copy

Case Me.ComboBox1.Value = "Transfer_Payment_Non_Postables"

Sheet1.Range("I11").Copy

Case Me.ComboBox1.Value = "Transfer_Payment_Related"

Sheet1.Range("I12").Copy

Case Me.ComboBox1.Value = "Transfer_Credit"

Sheet1.Range("I13").Copy

Case Me.ComboBox1.Value = "Remit_Request"

Sheet1.Range("I14").Copy

Case Me.ComboBox1.Value = "Insufficient_Remit"

Sheet1.Range("I15").Copy

Case Me.ComboBox1.Value = "Transposition_Error"

Sheet1.Range("I16").Copy

Case Me.ComboBox1.Value = "Short_Payment"

Sheet1.Range("I17").Copy

Case Me.ComboBox1.Value = "Over_Payment"

Sheet1.Range("I18").Copy

Case Me.ComboBox1.Value = "Assigned_to_Staples"

Sheet1.Range("I19").Copy


End Select

End With

End Sub
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

davidausten

New Member
Joined
Sep 1, 2017
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
dave im not sure what your code is doing. i tried implementing jasons and tried to try yours but im lost.
 

davidausten

New Member
Joined
Sep 1, 2017
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
right now i have this:
VBA Code:
Select Case ComboBo1.Value

Case "Flat_Payment"
Application.CutCopyMode = False
Sheet1.Range("I2").copy

Case "Duplicate_Payment_Invoice"
Application.CutCopyMode = False
Sheet1.Range("I3").Copy

etc
 

davidausten

New Member
Joined
Sep 1, 2017
Messages
35
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

will do
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
10,828
Office Version
  1. 2019
Platform
  1. Windows
Is it an ActiveX combobox on the worksheet, or is it in a userform?

With an ActiveX box in the worksheet both of the original suggestions work fine without the need for cutcopymode = false. The last selection is held on the clipboard with subsequent changes being reflected as would be expected.
 

davidausten

New Member
Joined
Sep 1, 2017
Messages
35
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

heres the drop box link to the workbook. to answer the question its an activeX on a worksheet but will need to work on the form the opens when you open the workbook.

 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
10,828
Office Version
  1. 2019
Platform
  1. Windows
I've tried Dave's first suggestion with your workbook and it works fine for me.
 

davidausten

New Member
Joined
Sep 1, 2017
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
can you please send it back to dropbox with the changes?
 

Watch MrExcel Video

Forum statistics

Threads
1,108,719
Messages
5,524,459
Members
409,582
Latest member
riibuildersinc

This Week's Hot Topics

Top