ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error 1004 from worksheet activate procedure (https://www.excelbanter.com/excel-programming/334468-error-1004-worksheet-activate-procedure.html)

mikeburg[_9_]

Error 1004 from worksheet activate procedure
 

I wanted VBA code in a worksheet called DATA to execute when I click the
tab of a worksheet called PRINT ENVELOPES of the same workbook.
Therefore, I put it in PRINT ENVELOPES worksheet activate. Naturally,
I am taking data from the DATA worksheet just left by using

sheets("data").select before each procedure. The procedure starts, but
I get the following error:

Runtime Error 1004

Application-Defined or Object Defined error

I tried leaving the code in the DATA worksheet & put a call statement
in the Print Envelopes worksheet activate section calling the
procedure. Again, the procedure starts, but I get the same error.

Any ideas?

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=387018


Jim Thomlinson[_4_]

Error 1004 from worksheet activate procedure
 
why bother selecting the sheet? That is probably where you error lies.

Private Sub Worksheet_Activate()
Sheets("Data").PrintPreview 'Change to Printout

End Sub

--
HTH...

Jim Thomlinson


"mikeburg" wrote:


I wanted VBA code in a worksheet called DATA to execute when I click the
tab of a worksheet called PRINT ENVELOPES of the same workbook.
Therefore, I put it in PRINT ENVELOPES worksheet activate. Naturally,
I am taking data from the DATA worksheet just left by using

sheets("data").select before each procedure. The procedure starts, but
I get the following error:

Runtime Error 1004

Application-Defined or Object Defined error

I tried leaving the code in the DATA worksheet & put a call statement
in the Print Envelopes worksheet activate section calling the
procedure. Again, the procedure starts, but I get the same error.

Any ideas?

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=387018




All times are GMT +1. The time now is 11:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com