hi,
i'm writing a code to compare the to cell values which got dates. but the problem is it not working. can anyone help to solve this problem.
once i change the value in the cell the change event will fire and goes to other sheet. their it should compare the cell values.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "F9" Then
Dim maindate As String
Dim myRange As Range
Dim val As String
Worksheets("Basis and assumptions").Select
maindate = Range("f9")
Worksheets("Sheet1").Select
Set myRange = Range("Q59,Q169")
For i = 59 To 166
For j = 1 To myRange.Rows.Count
If myRange.Cells(i, j).Value = maindate Then
MsgBox ("found the cell")
Worksheets("Basis and assumptions").Select
End If
Next j
Next i
End If
End Sub
those cells are from Q59 to Q169. maindate value is from one sheet.. can anyone give an idea please
Bookmarks