View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_2_] Rowan Drummond[_2_] is offline
external usenet poster
 
Posts: 18
Default C# programming - Getting number of last non-blank cell (column)in a row.

Not sure how you translate this into C# but in VBA it would be

lastColumnNumber = xsheet.cells(1,columns.count).end(xltoleft).column

Hope this helps
Rowan

Paddy wrote:
I need to get the column number of the last non-blank cell in a row. I
am using the Excel Com object in a .NET app to get this done

I have something like this
Range rg = xSheet.get_Range("A1","A1"); // xSheet is the worksheet
object.
int lastColumnNumber = rg.Cells.....

I am not sure what the method call to do or the steps to follow.
Any help is appreciated,
- K.