I would like to convert this VBA code in C#
Can anyone please help.
Dim Lrow,LColumn as Long
Sheet1.Activate
If WorksheetFunction.CountA(Cells) > 0 Then
LRow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
LColumn = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
End If
ketan borsdiyaPosted Jul 6, 2016, 4:55 AM
Guest UserPosted Jul 6, 2016, 5:25 AM
Guest UserPosted Jul 6, 2016, 4:05 AM
long LColumn = 0;
xlWorkSheet.Activate();
int dataCount = (int)xlApp.WorksheetFunction.CountA(xlWorkSheet.Cells);
if (dataCount == 0)
{
// All cells on the worksheet are empty.
}
else
{
// There is at least one cell on the worksheet that has non-empty contents.
{
Lrow = xlWorkSheet.Cells.Find(What: "*", After: xlWorkSheet.Cells[1, 1], SearchOrder: xlByRows, SearchDirection: xlPrevious).Row;
LColumn = xlWorkSheet.Cells.Find(What: "*", After: xlWorkSheet.Cells[1, 1], SearchOrder: xlByColumns, SearchDirection: xlPrevious).Column;
}
}
Francis SusaimichaelPosted Jul 6, 2016, 2:46 AM
Suvendu Shekhar GiriPosted Jul 6, 2016, 2:42 AM
if (WorksheetFunction.CountA(Cells) > 0) {