Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks but I was specifically looking for C# way to do this. The COM
API that is exposed to Visual Studio (i am referencing the Excel 9/10 COM object in my solution) does not explain the API nor the arguments that are used. So, I actually have xsheet.Cells but it is a property and I don't see the sequence of method calls from there to get the last non-blank column number. - K Rowan Drummond wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
row number of last non-blank cell | Excel Worksheet Functions | |||
macro that will paste a number in first blank cell of a column | Excel Discussion (Misc queries) | |||
SUM values in this column F only if cell is blank in column Q...HE | Excel Discussion (Misc queries) | |||
how to calculate the number of non blank cells from any column? | Excel Worksheet Functions | |||
Number of different items in an entire column without knowing if some of the cells are blank | Excel Programming |