ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to compare datas (https://www.excelbanter.com/excel-programming/426824-re-macro-compare-datas.html)

Mike

Macro to compare datas
 
Sub changeValues()
Const COLUMNB As String = "B"
Const COLUMND As String = "D"
Const COLUMNRESULTS = "E"

Dim iStartingRow As Long
Dim iLastRow As Long

iLastRow = Range(COLUMNB & Rows.Count).End(xlUp).Row
For iStartingRow = 2 To iLastRow
If Range(COLUMNB & iStartingRow).Value = Range(COLUMND &
iStartingRow).Value Then
Range(COLUMNRESULTS & iStartingRow).Value = "YES"
Else
Range(COLUMNRESULTS & iStartingRow).Value = "NO"
End If
Next
End Sub

"Dani Lima" wrote:

I need to compare a group of lines. On my worksheet there are lines with the
same number or order (colum B) (numericaly classified) and another colum (D)
with same datas, I need to compare if the number of the order are the same
and if the data on the columm d at the same line are the same, if so, the
macre should answer 'yes',if one of the datas on the columm d are different
the macro should answer 'no'.

Someone could help me?

regards, Dani



All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com