I keep getting a Runtime Error 13: Type Mismatch with the below code
The error occurs with the first IF .Range("F11") line of code. I have tried calling out the range with out the with, Worksheets("Lot Numbers").Range("F11").Value. I have tried changing it to .Range("F11").Text vs Value, but still run into the same error. Here is a screen shoot of my workbook names.
Am I using Worksheets wrong? When I remove that section of code I don't encounter an error.
Thanks for any help!
VBA Code:
Private Sub UserForm_Initialize()
HideCloseButton Me
ComboBox1.List = Array("Anti-A", "Anti-B", "Anti-D", "Anti-A,B", "Anti-IgG", "6% Albumin", "PeG+QC AB")
ComboBox2.List = Array("Anti-A", "Anti-B", "Anti-D", "Anti-A,B", "Anti-IgG", "6% Albumin", "PeG+QC AB")
ComboBox3.List = Array("Anti-A", "Anti-B", "Anti-D", "Anti-A,B", "Anti-IgG", "6% Albumin", "PeG+QC AB")
ComboBox4.List = Array("Anti-A", "Anti-B", "Anti-D", "Anti-A,B", "Anti-IgG", "6% Albumin", "PeG+QC AB")
ComboBox5.List = Array("A1 Cells", "A2 Cells", "B Cells", "IgG CC", "SC I&II")
ComboBox6.List = Array("A1 Cells", "A2 Cells", "B Cells", "IgG CC", "SC I&II")
ComboBox7.List = Array("A1 Cells", "A2 Cells", "B Cells", "IgG CC", "SC I&II")
ComboBox8.List = Array("A1 Cells", "A2 Cells", "B Cells", "IgG CC", "SC I&II")
With Worksheets("Lot Numbers")
If .Range("F11").Value = Array("Anti-A", "Anti-B", "Anti-D", "Anti-A,B", "Anti-IgG", "6% Albumin", "PeG+QC AB") Then
ComboBox1.Value = .Range("F11").Value
ElseIf .Range("F11").Value = Array("A1 Cells", "A2 Cells", "B Cells", "IgG CC", "SC I&II") Then
ComboBox5.Value = .Range("F11").Value
End If
End With
The error occurs with the first IF .Range("F11") line of code. I have tried calling out the range with out the with, Worksheets("Lot Numbers").Range("F11").Value. I have tried changing it to .Range("F11").Text vs Value, but still run into the same error. Here is a screen shoot of my workbook names.
Am I using Worksheets wrong? When I remove that section of code I don't encounter an error.
Thanks for any help!