laxminarayana
Board Regular
- Joined
- Nov 16, 2013
- Messages
- 56
Hi,
In cell "B8" of worksheet1 contains a date. And in worksheet3 there is a list of Dates. what i am trying to do is when the date in cell "B8" is in the list of dates in sheet3, i want to insert a line in sheet2. And if date in cell "B8"
is not present in the dates list of worksheet3 i want to insert a different line. I have written the following code, but it is not doing anything. Can somebody help me with this.
In cell "B8" of worksheet1 contains a date. And in worksheet3 there is a list of Dates. what i am trying to do is when the date in cell "B8" is in the list of dates in sheet3, i want to insert a line in sheet2. And if date in cell "B8"
is not present in the dates list of worksheet3 i want to insert a different line. I have written the following code, but it is not doing anything. Can somebody help me with this.
Code:
Sub smarttext()
Dim ws1 As Worksheet: Set ws1 = Sheets("Sheet1")
Dim ws2 As Worksheet: Set ws2 = Sheets("Sheet2")
Dim ws3 As Worksheet: Set ws3 = Sheets("Sheet3")
If ws1.Range("B8").Value = ws3.Range("D12:D28").Value Then
If ws2.Range("D1").Value = "" Then
ws2.Range("D1").Value = "Please assign the documents after two days"
Else
ws2.Range("D1").Value = ws2.Range("D1").Value & vbLf & vbLf & "Please assign the documents after two days"
End If
Else
If ws2.Range("D1").Value = "" Then
ws2.Range("D1").Value = "Please assign the documents"
Else
ws2.Range("D1").Value = ws2.Range("D1").Value & vbLf & vbLf & "Please assign the documents"
End If
End If
End Sub