Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
any suggestions about why this is not working;
....it always finds the last fellof data on th e sheet as "A1" (it is not) 'determine last row of data Set foundcell = Cells.Find("*", Range("A1"), xlValues, xlPart, xlByRows, xlPrevious) If foundcell Is Nothing = 0 Then lDataRow = 1 lDataCell = Range("A1").Address Else lDataRow = foundcell.Row lDataCell = foundcell End If thanks in advance, mark |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I use this to give the intersect cell of the last used Row and last
used Column: Function FindLastCell() As Range Dim LastColumn As Integer Dim LastRow As Long Dim LastCell As Range If WorksheetFunction.CountA(Cells) 0 Then 'Search for any entry, by searching backwards by Rows. LastRow = Cells.Find(What:="*", After:=[A1], _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious).Row 'Search for any entry, by searching backwards by Columns. LastColumn = Cells.Find(What:="*", After:=[A1], _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious).Column Set FindLastCell = Cells(LastRow, LastColumn) Else Set FindLastCell = Range("A1") End If End Function Charles mark kubicki wrote: any suggestions about why this is not working; ...it always finds the last fellof data on th e sheet as "A1" (it is not) 'determine last row of data Set foundcell = Cells.Find("*", Range("A1"), xlValues, xlPart, xlByRows, xlPrevious) If foundcell Is Nothing = 0 Then lDataRow = 1 lDataCell = Range("A1").Address Else lDataRow = foundcell.Row lDataCell = foundcell End If thanks in advance, mark |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would try
Sub abc() Set foundcell = Cells.Find("*", Range("A1"), xlFormulas, xlPart, xlByRows, xlPrevious) If foundcell Is Nothing Then lDataRow = 1 lDataCell = Range("A1").Address Else lDataRow = foundcell.Row lDataCell = foundcell End If Debug.Print lDataRow, lDateCell End Sub -- Regards, Tom Ogilvy "mark kubicki" wrote: any suggestions about why this is not working; ....it always finds the last fellof data on th e sheet as "A1" (it is not) 'determine last row of data Set foundcell = Cells.Find("*", Range("A1"), xlValues, xlPart, xlByRows, xlPrevious) If foundcell Is Nothing = 0 Then lDataRow = 1 lDataCell = Range("A1").Address Else lDataRow = foundcell.Row lDataCell = foundcell End If thanks in advance, mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need help finding the last cell w/data | Excel Worksheet Functions | |||
Formula finding last cell in row containing data | Excel Worksheet Functions | |||
Formula for finding next cell with data? | Excel Discussion (Misc queries) | |||
Finding Last Cell that Has Data | Excel Programming | |||
Finding matching cell data | Excel Worksheet Functions |