michaeltsmith93
Board Regular
- Joined
- Sep 29, 2016
- Messages
- 83
Hi, in addition to the If statement causing error 13, I'm getting 1004 in the With statement. Thoughts?
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
If (Trim(Me.ptmember.Value) Or Trim(Me.StudyRole.Value) Or Trim(Me.MatrixRole.Value) Or Trim(Me.Department.Value)) = "" Then
MsgBox "Please fill all fields."
Exit Sub
End If
With ws
[COLOR=#ff0000] .Cells(ERow, 1).Value = Me.ptmember.Value[/COLOR]
.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