Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Sonu,
change LR = ex.Range("A65536").End(xlup).Row to x = ex.Range("A65536").End(-4162&).Row The xl constants won't be recognized if you are using 'Late Binding'. Regards, Peter T "sonu" wrote in message ups.com... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks peter it is working now On Nov 27, 6:15 pm, "Peter T" <peter_t@discussions wrote: Hi Sonu, change LR = ex.Range("A65536").End(xlup).Rowto x = ex.Range("A65536").End(-4162&).Row The xl constants won't be recognized if you are using 'Late Binding'. Regards, Peter T "sonu" wrote in oglegroups.com... 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- Hide quoted text -- Show quoted text - |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This might do it.
LR = ex.Worksheets(5).Range("A65536").End(xlUp).Row "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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SUM command not working | Excel Worksheet Functions | |||
end command not working | Excel Programming | |||
ChangeLink Command Not Working | Excel Programming | |||
command button isn't working | New Users to Excel | |||
Kill command not working | Excel Programming |