![]() |
Open Event
Can you have an open event select a cell? I am trying to run macros
and select cells and it is nto working. Here is my code. As soon as it gets to a line to select a cell it errors out. Thanks, Jay Private Sub Workbook_Open() Application.ScreenUpdating = False Run "SortSheets1" Run "SortSheets2" Sheets("HK Ips").Range("E5").Select Run "AddSheet" Sheet2.Range("C5").Select Run "AddSheet" Sheet3.Range("C5").Select Run "AddSheet" Sheet4.Range("E5").Select Run "AddSheet" Sheet5.Range("E5").Select Run "AddSheet" Sheet6.Range("E5").Select Sheet7.Range("C5").Select Run "AddSheet" Sheet8.Range("E5").Select Run "AddSheet" Sheet9.Range("E5").Select Run "AddSheet" Sheet11.Range("D5").Select Run "AddSheet" Sheet12.Range("E5").Select Run "AddSheet" Run "SortSheets1" Application.ScreenUpdating = True End Sub |
Open Event
You not need to select cells with code for 99%
Change you code without selecting You can't select a cell on a sheet that is not active so first select the sheet and then the cell -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "jlclyde" wrote in message ... Can you have an open event select a cell? I am trying to run macros and select cells and it is nto working. Here is my code. As soon as it gets to a line to select a cell it errors out. Thanks, Jay Private Sub Workbook_Open() Application.ScreenUpdating = False Run "SortSheets1" Run "SortSheets2" Sheets("HK Ips").Range("E5").Select Run "AddSheet" Sheet2.Range("C5").Select Run "AddSheet" Sheet3.Range("C5").Select Run "AddSheet" Sheet4.Range("E5").Select Run "AddSheet" Sheet5.Range("E5").Select Run "AddSheet" Sheet6.Range("E5").Select Sheet7.Range("C5").Select Run "AddSheet" Sheet8.Range("E5").Select Run "AddSheet" Sheet9.Range("E5").Select Run "AddSheet" Sheet11.Range("D5").Select Run "AddSheet" Sheet12.Range("E5").Select Run "AddSheet" Run "SortSheets1" Application.ScreenUpdating = True End Sub |
Open Event
On Sep 17, 10:31*am, "Ron de Bruin" wrote:
You not need to select cells with code for 99% Change you code without selecting You can't select a cell on a sheet that is not active so first select the sheet and then the cell -- Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm "jlclyde" wrote in ... Can you have an open event select a cell? *I am trying to run macros and select cells and it is nto working. *Here is my code. *As soon as it gets to a line to select a cell it errors out. Thanks, Jay Private Sub Workbook_Open() * *Application.ScreenUpdating = False * *Run "SortSheets1" * *Run "SortSheets2" * *Sheets("HK Ips").Range("E5").Select * *Run "AddSheet" * *Sheet2.Range("C5").Select * *Run "AddSheet" * *Sheet3.Range("C5").Select * *Run "AddSheet" * *Sheet4.Range("E5").Select * *Run "AddSheet" * *Sheet5.Range("E5").Select * *Run "AddSheet" * *Sheet6.Range("E5").Select * *Sheet7.Range("C5").Select * *Run "AddSheet" * *Sheet8.Range("E5").Select * *Run "AddSheet" * *Sheet9.Range("E5").Select * *Run "AddSheet" * *Sheet11.Range("D5").Select * *Run "AddSheet" * *Sheet12.Range("E5").Select * *Run "AddSheet" * *Run "SortSheets1" * *Application.ScreenUpdating = True End Sub- Hide quoted text - - Show quoted text - OK. I have to select cells in this case because the macro that runs is a do until selection, so I have am telling it where to start. Now one of the Macros comes up as an error "the Macro AddSheet can not be found" I know it is in Module1 so I do nto knwo what to do about this. Let me knwo if I shoudl start a new post since the subject changed. Thanks, Jay |
Open Event
Show use the macro
-- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "jlclyde" wrote in message ... On Sep 17, 10:31 am, "Ron de Bruin" wrote: You not need to select cells with code for 99% Change you code without selecting You can't select a cell on a sheet that is not active so first select the sheet and then the cell -- Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm "jlclyde" wrote in ... Can you have an open event select a cell? I am trying to run macros and select cells and it is nto working. Here is my code. As soon as it gets to a line to select a cell it errors out. Thanks, Jay Private Sub Workbook_Open() Application.ScreenUpdating = False Run "SortSheets1" Run "SortSheets2" Sheets("HK Ips").Range("E5").Select Run "AddSheet" Sheet2.Range("C5").Select Run "AddSheet" Sheet3.Range("C5").Select Run "AddSheet" Sheet4.Range("E5").Select Run "AddSheet" Sheet5.Range("E5").Select Run "AddSheet" Sheet6.Range("E5").Select Sheet7.Range("C5").Select Run "AddSheet" Sheet8.Range("E5").Select Run "AddSheet" Sheet9.Range("E5").Select Run "AddSheet" Sheet11.Range("D5").Select Run "AddSheet" Sheet12.Range("E5").Select Run "AddSheet" Run "SortSheets1" Application.ScreenUpdating = True End Sub- Hide quoted text - - Show quoted text - OK. I have to select cells in this case because the macro that runs is a do until selection, so I have am telling it where to start. Now one of the Macros comes up as an error "the Macro AddSheet can not be found" I know it is in Module1 so I do nto knwo what to do about this. Let me knwo if I shoudl start a new post since the subject changed. Thanks, Jay |
Open Event
Don't use Run
Simply.......... Private Sub Workbook_Open() Application.ScreenUpdating = False SortSheets1 SortSheets2 etc. Gord Dibben MS Excel MVP On Wed, 17 Sep 2008 08:19:22 -0700 (PDT), jlclyde wrote: Private Sub Workbook_Open() Application.ScreenUpdating = False Run "SortSheets1" Run "SortSheets2" |
Open Event
Or use
Call macroname -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Gord Dibben" <gorddibbATshawDOTca wrote in message ... Don't use Run Simply.......... Private Sub Workbook_Open() Application.ScreenUpdating = False SortSheets1 SortSheets2 etc. Gord Dibben MS Excel MVP On Wed, 17 Sep 2008 08:19:22 -0700 (PDT), jlclyde wrote: Private Sub Workbook_Open() Application.ScreenUpdating = False Run "SortSheets1" Run "SortSheets2" |
All times are GMT +1. The time now is 03:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com