Переделать код макроса VBA в код C#
Sub tt()
Dim a(), i&
a = [a1].CurrentRegion.Columns(1).Resize(, 2).Value
With CreateObject("scripting.dictionary"): .comparemode = 1
For i = 1 To UBound(a)
If Not .exists(a(i, 1)) Then
.Item(a(i, 1)) = a(i, 2)
Else: a(i, 2) = .Item(a(i, 1))
End If
Next
End With
[a1].CurrentRegion.Columns(1).Resize(, 2).Value = a
End Sub
Sub tr()
Dim r As Long, firstrow As Long, lastrow As Long
firstrow = ActiveSheet.UsedRange.Row
lastrow = ActiveSheet.UsedRange.Rows.Count - 1 + ActiveSheet.UsedRange.Row
For r = lastrow To firstrow Step -1
If Application.CountA(Rows(r)) = 0 Then
Rows(r).Delete
End If
Next r
End Sub