Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Folks,
In VBA I have frequently used the formula: last_row = ActiveWorkbook.Sheets("Sheet1").Range("A65534").En d(xlUp).Row to find the last cell with data in it in column A of Sheet1. In Visual Studio Tools for Office (C#) the equivalent expression I have just discovered is: Sheet1.get_Range("A65534", Type.Missing).get_End(Excel.XlDirection.xlUp).Row -- Bob Sullentrup |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your method would not work if the last cell used was on row 65534, 65535, or
65536. Even if you corrected your typo (should have said 65536), if the data extended to row 65536, you'd end either on Row 1 or on the last occurrence of a break in the data, using End(xlUP). And what if there is no data in Col A ... or what if the data in colums other than A extended below rows which Col A's data held? There are a lot of other ways to get last row. The quickest I know is: Activesheet.UsedRange.SpecialCells(xlcelltypelastc ell).Row "Bob Sullentrup" wrote in message ... Folks, In VBA I have frequently used the formula: last_row = ActiveWorkbook.Sheets("Sheet1").Range("A65534").En d(xlUp).Row to find the last cell with data in it in column A of Sheet1. In Visual Studio Tools for Office (C#) the equivalent expression I have just discovered is: Sheet1.get_Range("A65534", Type.Missing).get_End(Excel.XlDirection.xlUp).Row -- Bob Sullentrup |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count nonblank cells based on another column | Excel Worksheet Functions | |||
CELL EQUALS LAST NONBLANK CELL IN A COLUMN | Excel Worksheet Functions | |||
Require a cell to be nonblank if another cell is nonblank | Excel Discussion (Misc queries) | |||
Find last nonblank in a column | Excel Worksheet Functions | |||
Find last nonblank cell in column | Excel Programming |