I'm trying to compare values in cells from two different spreadsheets.
Can anyone explain why this line doesn't think the values are equal (it never triggers):
if (destCell.Value == sourceWorksheet.Cells[1, 1].Value)
The actual values of each:
? destCell.Value
{3/31/2022 12:00:00 AM}
Date: {3/31/2022 12:00:00 AM}
Day: 31
DayOfWeek: Thursday
DayOfYear: 90
Hour: 0
Kind: Unspecified
Millisecond: 0
Minute: 0
Month: 3
Second: 0
Ticks: 637842816000000000
TimeOfDay: {00:00:00}
Year: 2022
? sourceWorksheet.Cells[1, 1].Value
{3/31/2022 12:00:00 AM}
Date: {3/31/2022 12:00:00 AM}
Day: 31
DayOfWeek: Thursday
DayOfYear: 90
Hour: 0
Kind: Unspecified
Millisecond: 0
Minute: 0
Month: 3
Second: 0
Ticks: 637842816000000000
TimeOfDay: {00:00:00}
Year: 2022
CodePudding user response:
Text is what I needed...
if (destCell.Text == sourceWorksheet.Cells[1, 1].Text)