Another suggestion you may be able to work with. Note that you requested to
search column B and put the time in column C, but your code comments indicate
you want the time in Column E. I used B and C.
You will need to change the worksheet name for rngSearch to whatever your
sheet is actually named. Watch for word wrap and be sure to back up before
trying.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strCriteria As String
Dim rngSearch As Range
Dim rngFound As Range
strCriteria = Replace(Target.Address(True, True, xlA1, True), _
"[" & ThisWorkbook.Name & "]", "", 1, 1, vbTextCompare)
Set rngSearch = Sheets("Sheet2").Columns(2) '<<<CHANGE
With rngSearch
Set rngFound = .Find( _
What:=strCriteria, _
After:=.Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
matchbyte:=False)
End With
If Not rngFound Is Nothing Then
With rngFound.Parent.Range("C" & rngFound.Row)
.Value = Now
.NumberFormat = """Changed ""m/d/yyyy h:mm:ss AM/PM"
End With
End If
End Sub
"Sharon" wrote:
> I need to use the Change Event for the following
>
> Find the cell that changed on worsheet1 (easy (target.address))
>
> Find the formula in worksheet2, column B that is referencing the
> target.address in worksheet1.
> store the time in column c on worksheet2 on the same row as the
> formula
>
> I've been chasing my tale on this and appreciate any and all feedack
>
> THANKS
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> ' Intercept a change event on the form
> MsgBox "Range " & Target.Address & " was changed"
> '
> ' for example - Form B4 is referenced by B11 in the upload
> spreadsheet
> ' the formula in B11 is '=Form!$B$4
> ' Form F4 is referenced by B23 in the upload
> spreadsheet (=Form!$F$23)
> '
> ' use absolute formulas
>
> ' store the date (now()) in the column E of the same row with the
> formula in the upload sheet
> 'store the word 'changed' in column F in the upload sheet
> ' for example, E and F of row 11 in upload ... when Form B4
> changes
> End Sub
>
>
|