I am converting some (more) codes from Excel VBA to C#. Everything is working fine except these lines below:
VBA:
With Selection
With Range(Cells(1, 1), Cells(.Row - 1, .Column - 1))
X = .Width
Y = .Height
End With
W = .Width
H = .Height
End With
My C# Conversion:
Excel.Range SelectedCells = Globals.ThisAddIn.Application.Selection;
Excel.Range SelectedRange = SelectedCells.Range[SelectedCells.Cells[1, 1], SelectedCells.Cells[SelectedCells.Row - 1, SelectedCells.Column - 1]];
float X = (float)SelectedRange.Width;
float Y = (float)SelectedRange.Height;
float W = (float)SelectedCells.Width;
float H = (float)SelectedCells.Height;
I managed to get W & H to match up but X and Y are way off. What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire