![]() |
Assign Macro with Hidden Sheet
Hi,
I made assign macro in sheet 1 which is linked to sheet 2. Whenever I hide sheet 2, It wont works and says : run-time error '1004' select method of worksheet class failed. Then it will open VBS array with yellow mark status need to be edited or something. How can I solve this problem? Much Appreciate, Pran |
Assign Macro with Hidden Sheet
Hi,
Instead of Sheets("Sheet2").Select use Sheets("Sheet2").Activate If this fails then you should enter the appropriate line in the procedure to unhide the sheet, run your code and re-hide the sheet when the code has completed Alan -- Message posted via http://www.officekb.com |
Assign Macro with Hidden Sheet
Yes, So far it works !!!
One more question is, if I now protect the sheet with password, then is there any additional array that I should make? Many thx for your help, Pran "Alan McQuaid via OfficeKB.com" wrote: Hi, Instead of Sheets("Sheet2").Select use Sheets("Sheet2").Activate If this fails then you should enter the appropriate line in the procedure to unhide the sheet, run your code and re-hide the sheet when the code has completed Alan -- Message posted via http://www.officekb.com |
Assign Macro with Hidden Sheet
What are you doing to Sheet2 that needs it to be selected?
Generally Sheets do not have to be selected to work upon them. Post the code for review. Gord Dibben MS Excel MVP On Fri, 24 Jul 2009 00:16:02 -0700, Pran wrote: Hi, I made assign macro in sheet 1 which is linked to sheet 2. Whenever I hide sheet 2, It wont works and says : run-time error '1004' select method of worksheet class failed. Then it will open VBS array with yellow mark status need to be edited or something. How can I solve this problem? Much Appreciate, Pran |
Assign Macro with Hidden Sheet
Sub Corporate_Deed()
' ' Corporate_Deed Macro ' ' Sheets("A. CORPORATE DEED").Select Range("B3").Select End Sub Sub Home() ' ' Home Macro ' ' Sheets("MAIN PAGE").Select Range("B2:G2").Select End Sub I should correct previous email, it doesnt work, coz it is linked to another visible sheet 3, rather than hidden sheet 2. How can I enter appropriate line? Regards, "Gord Dibben" wrote: What are you doing to Sheet2 that needs it to be selected? Generally Sheets do not have to be selected to work upon them. Post the code for review. Gord Dibben MS Excel MVP On Fri, 24 Jul 2009 00:16:02 -0700, Pran wrote: Hi, I made assign macro in sheet 1 which is linked to sheet 2. Whenever I hide sheet 2, It wont works and says : run-time error '1004' select method of worksheet class failed. Then it will open VBS array with yellow mark status need to be edited or something. How can I solve this problem? Much Appreciate, Pran |
Assign Macro with Hidden Sheet
Gord's question was why are you selecting anything on that hidden sheet?
There's really not too many things that require that you select anything before working on it. But if you want to select a range, you're going to have to make that sheet visible first: With worksheets("A. CORPORATE DEED") .visible = xlsheetvisible .range("b3").select End with Pran wrote: Sub Corporate_Deed() ' ' Corporate_Deed Macro ' ' Sheets("A. CORPORATE DEED").Select Range("B3").Select End Sub Sub Home() ' ' Home Macro ' ' Sheets("MAIN PAGE").Select Range("B2:G2").Select End Sub I should correct previous email, it doesnt work, coz it is linked to another visible sheet 3, rather than hidden sheet 2. How can I enter appropriate line? Regards, "Gord Dibben" wrote: What are you doing to Sheet2 that needs it to be selected? Generally Sheets do not have to be selected to work upon them. Post the code for review. Gord Dibben MS Excel MVP On Fri, 24 Jul 2009 00:16:02 -0700, Pran wrote: Hi, I made assign macro in sheet 1 which is linked to sheet 2. Whenever I hide sheet 2, It wont works and says : run-time error '1004' select method of worksheet class failed. Then it will open VBS array with yellow mark status need to be edited or something. How can I solve this problem? Much Appreciate, Pran -- Dave Peterson |
All times are GMT +1. The time now is 07:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com