Hi guys
When the whole row in excelsheet is full for particular date that means all the values of columns (Legal Charge,GA and DNM) have been entered for particular date then display an error message if the another user tries to enter the values for the same date .
It means the user can enter the values for same date only if values of Legal Charge,GA and DNM are empty,otherwise an error message should pop up.
Private Sub CommandButton1_Click()
Dim iR As Long
Dim ws1 As Worksheet
Set ws1 = Worksheets("sheet2")
With ws1
Set i = .Columns(1).Find(What:=DateValue(ComboBox1.Value), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If i Is Nothing Then
iR = .Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Else
iR = i.Row
End If
.Cells(iR, 1).Value = Format(ComboBox1.Value, "mm/dd/yyyy")
.Cells(iR, 2).Value = Format(Now, "hh:mm")
.Cells(iR, 3).Value = Application.UserName
If ComboBox2.Value = "Legal Charge" Then
.Cells(iR, 4).Value = Me.TextBox1.Value
.Cells(iR, 5).Value = Me.TextBox3.Value
ElseIf ComboBox2.Value = "DNM" Then
.Cells(iR, 6).Value = Me.TextBox1.Value
.Cells(iR, 7).Value = Me.TextBox3.Value
.Cells(iR, 8).Value = Me.TextBox2.Value
Else
.Cells(iR, 9).Value = Me.TextBox1.Value
.Cells(iR, 10).Value = Me.TextBox3.Value
.Cells(iR, 11).Value = Me.TextBox2.Value
End If
End With
End Sub
Can anyone please figure out my problem.
Thanks
Aman
Bookmarks