michaeltsmith93
Board Regular
- Joined
- Sep 29, 2016
- Messages
- 83
Hi, I am getting a type mismatch for the If statement in the following code:
Code:
Private Sub OK_Click()
Dim ERow As Long
Dim ws As Worksheet
Set ws = Worksheets("Tracker")
'find first empty row
ERow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for input
[COLOR=#ff0000]If (Trim(Me.ptmember.Value) Or Trim(Me.StudyRole.Value) Or Trim(Me.MatrixRole.Value) Or Trim(Me.Department.Value))[/COLOR] = "" Then
MsgBox "Please fill all fields."
Exit Sub
End If
With ws
.Cells(ERow, 1).Value = Me.ptmember.Value
.Cells(ERow, 2).Value = Me.StudyRole.Value
.Cells(ERow, 4).Value = Me.MatrixRole.Value
.Cells(ERow, 5).Value = Me.Department.Value
End With
Me.ptmember.Value = ""
Me.StudyRole.Value = ""
Me.MatrixRole.Value = ""
Me.Department.Value = ""
End Sub