D
DDawson
Eliano and JLG Whiz both kindly contributed to the enclosed macro which
checks the value of each cell in column A of Targetdoc against the values in
Sourcedoc xlValues and when a match is found, it enters a textstring into the
corresponding cell in Column "I".
I originally used today's date as the text string, but since Sourcedoc has a
"Date Created" column, it makes sense to insert this value rather than a
textstring into the Targetdoc when the match is found.
How do check the value of each cell in Column A of Targetdoc against the
values in column A in Sourcedoc...
And when a match is found...
Enter the value of column B (of the found row), of Sourcedoc into...
Column I (of the checkvalue row), of Targetdoc?
Also, how do I amend the ninth line of the Macro so that ActiveSheet.Range
expands as more data is added?
Sub CheckData()
Dim c As Range
Dim findC As Variant
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Windows("Report.xls").Activate '<-- My report
For Each c In ActiveSheet.Range("A2:A90")
If Not c Is Nothing Then
Windows("SourceDoc.xls").Activate '<-- My document to be checked
Set findC = Worksheets("Sheet1").Cells _
.Find(c.Value, LookIn:=xlValues)
If Not findC Is Nothing Then
Windows("Report.xls").Activate
ActiveSheet.Range("I" & c.Row).Cells.Value = "20/02/2008"
End If
End If
Next
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
Kind Regards
Dylan Dawson
checks the value of each cell in column A of Targetdoc against the values in
Sourcedoc xlValues and when a match is found, it enters a textstring into the
corresponding cell in Column "I".
I originally used today's date as the text string, but since Sourcedoc has a
"Date Created" column, it makes sense to insert this value rather than a
textstring into the Targetdoc when the match is found.
How do check the value of each cell in Column A of Targetdoc against the
values in column A in Sourcedoc...
And when a match is found...
Enter the value of column B (of the found row), of Sourcedoc into...
Column I (of the checkvalue row), of Targetdoc?
Also, how do I amend the ninth line of the Macro so that ActiveSheet.Range
expands as more data is added?
Sub CheckData()
Dim c As Range
Dim findC As Variant
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Windows("Report.xls").Activate '<-- My report
For Each c In ActiveSheet.Range("A2:A90")
If Not c Is Nothing Then
Windows("SourceDoc.xls").Activate '<-- My document to be checked
Set findC = Worksheets("Sheet1").Cells _
.Find(c.Value, LookIn:=xlValues)
If Not findC Is Nothing Then
Windows("Report.xls").Activate
ActiveSheet.Range("I" & c.Row).Cells.Value = "20/02/2008"
End If
End If
Next
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
Kind Regards
Dylan Dawson