Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Application / Object Error 1004

Hello

I have the above error msg on this line:-

Private Sub cmdAddBtn1_Click()
ActiveWorkbook.Sheets("HEA Payments").Activate

Sheets("HEA Payments").Range("A1").End(xlDown).Offset(1, 0).Select


What is wrong or how do i reference it?

Tx.


garrygdc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application / Object Error 1004

Your code ran fine for me.

Code was in the worksheet module of a sheet having cmdAddBtn1 and this
sheet was not HEA Payments.
HEA Payments and the sheet with the code were in the same workbook.
--
Regards,
Tom Ogilvy

"Garry" wrote in message
...
Hello

I have the above error msg on this line:-

Private Sub cmdAddBtn1_Click()
ActiveWorkbook.Sheets("HEA Payments").Activate

Sheets("HEA Payments").Range("A1").End(xlDown).Offset(1, 0).Select


What is wrong or how do i reference it?

Tx.


garrygdc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Application / Object Error 1004

Tom

Is was working fine for me then started with that error??

The actual worksheet is on a network drive that everyone has access
too?? full path is F:\hea..\...\payments.xls.

Having said that no-one should be accessing it as they would not know it
was actually there.

Are there any flags or settings that I should be resetting?


garrygdc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application / Object Error 1004

If it is in another workbook, then the code should be

Private Sub cmdAddBtn1_Click()
ActiveWorkbook.Sheets("HEA Payments").Activate
Activeworkbook.Sheets("HEA Payments").Range("A1") _
.End(xlDown).Offset(1, 0).Select

End Sub

--
Regards,
Tom Ogilvy


"Garry" wrote in message
...
Tom

Is was working fine for me then started with that error??

The actual worksheet is on a network drive that everyone has access
too?? full path is F:\hea..\...\payments.xls.

Having said that no-one should be accessing it as they would not know it
was actually there.

Are there any flags or settings that I should be resetting?


garrygdc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Application / Object Error 1004


Tom

Tx for the quick reply.

No that didn't work either. I tried a reboot too.

Could I be Activating the workbook/sheet too many times?

What would be the fully qualified statement?

Tx
garrygdc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application / Object Error 1004

Well there is no way to click a button on a worksheet and have another
workbook be the activeworkbook - should have recognized that fallacy from
the start. If you want to select a range in another workbook, you would
need to activate that workbook first.

Private Sub cmdAddBtn1_Click()
Workbooks("HEA Payments.xls").Activate
ActiveWorkbook.Sheets("HEA Payments").Activate
Activeworkbook.Sheets("HEA Payments").Range("A1") _
.End(xlDown).Offset(1, 0).Select

End Sub

Change the first line of code to reflect the actual name of the workbook.

--
Regards,
Tom Ogilvy


"Garry" wrote in message
...

Tom

Tx for the quick reply.

No that didn't work either. I tried a reboot too.

Could I be Activating the workbook/sheet too many times?

What would be the fully qualified statement?

Tx
garrygdc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 1004 Application Defined or Object Defined Error Garry[_6_] Excel Programming 2 October 1st 04 10:33 AM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM
"Run Time Error 1004 Application Defined or Object Defined Error." BJC Excel Programming 4 October 26th 03 03:09 AM
Runtime Error 1004 -- Application Defined or Object Defined Error John[_51_] Excel Programming 3 September 4th 03 04:28 PM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"