I've just had a look at the workbook and the first thing I saw in the code was this.
Dim UoW As ComboBox
Dim Letter As ComboBox
UoW and Letter are comboboxes on the userform so you shouldn't have variables with the same name in the code.
Also, you refer to a ComboBox1 when there isn't a ComboBox1.
ComboBox1 should be replaced with the name of the combobox which lists 231, 232 etc followed by .Value.
I think Letter might be the relevant combobox so I've used it in the following code.
Option Explicit
Private Sub CommandButton1_Click()
Dim strLetter As String
Select Case Letter.Value
Case 231, 232, 233, 234, 235, 236
strLetter = "Sophisticated"
Case 221, 222, 228, 229, 237
strLetter = "Unsophisticated"
End Select
Sheets("Sheet1").Unprotect ("lewings")
Sheets("Sheet2").Unprotect ("lewings")
Sheets("Sheet3").Unprotect ("lewings")
' Sophistication Testing - No Letter Sent
If Me.UoW.Value = "Sophistication Test" And strLetter = "None" Then
With Sheets("Sheet2")
With .Range("D2:S32")
.ClearContents
.Font.Underline = xlUnderlineStyleNone
.Font.ColorIndex = 0
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.MergeCells = True
.WrapText = True
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Bordersaround LineStyle:=xlContinuous, Weight:=xlMedium, ColorIndex:=xlAutomatic
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Value = """Your case is currently at the Sophistication Testing phase. I cannot provide you with a precise timeframe as to how long it will take for your case to complete this stage as each case is different.""" & vbNewLine & _
"""However on average once a case reaches this stage it typically takes " & Sheets("sheet3").Range("H5") & " weeks until an outcome is reached.""" & vbNewLine & _
vbNewLine & _
vbNewLine & _
"""As soon as the outcome is known we will write to you."""
End With
With .Range("A1")
.Font.Name = "Arial"
.Font.Size = 22
End With
End With
ElseIf Me.UoW = "Sophistication Test - No Unit of Work Quoted" And strLetter <> "None" Then
' code for No UoW & Sophistication Letter (Error)
ElseIf Me.UoW = "Sophistication Test" And strLetter = "Sophisticated" And LDate.Value = True Then
' code for Sophisticated Letter & Sophistication Test UoW
End If
Bookmarks