View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default End command not working

The XL object model is Application - Workbook - Worksheet - Range. You are
trying to go directly from the Application directly to the worksheet without
identifying the Workbook, which it will not like. Try something more like...

Sub LastRow()
Set ex = GetObject(, "excel.application")


LR =
ex.Workbooks("Book1.xls").worksheets("Sheet5").Ran ge("A65536").End(xlup).Row

set ex = nothing

End Sub

--
HTH...

Jim Thomlinson


"sonu" wrote:

I am trying to run this from power point

sonu wrote:
Sub LastRow()
Set ex = GetObject(, "excel.application")


ex.worksheets("Sheet5").Activate

LR = ex.Range("A65536").End(xlup).Row

set ex = nothing

End Sub

When I run this sub I get object define or applicaiton define error
when the code executes LR = ex.Range("A65536").End(xlup).Row line.

Any help is really appreciated.

Thanks

Sonu