Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Need Before_Save code

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor in
each worksheet to be placed in Cell A1, and the worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up first,
and as each of the other worksheets is opened, it shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Need Before_Save code

Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will run whenever
the workbook is opened and insure that "Scorecard" is the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor in
each worksheet to be placed in Cell A1, and the worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up first,
and as each of the other worksheets is opened, it shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Need Before_Save code

John, Thanks for your reply. I copy/pasted the code into
the "This Workbook" module, but it doesn't work. There is
no error message to hint of the problem either. Is there
something I should look for?
Thanks, Phil
-----Original Message-----
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will

run whenever
the workbook is opened and insure that "Scorecard" is the

active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor in
each worksheet to be placed in Cell A1, and the

worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up first,
and as each of the other worksheets is opened, it shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Need Before_Save code

Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will run whenever
the workbook is opened and insure that "Scorecard" is the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor in
each worksheet to be placed in Cell A1, and the worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up first,
and as each of the other worksheets is opened, it shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Need Before_Save code

John,

A new wrinkle - this code does indeed put the cursor in
A1, but you cant see cell A1, rather, it still shows
wherever the user left it when closing. How can I get the
screen to show cell A1?

Thanks, Phil
-----Original Message-----
Phil,

It shouldn't go in the "ThisWorkbook" module.
Right click on "ThisWorkbook" in the "Projects" window
and then choose "Insert/Module".
Paste it into the module that appears to the right.

John

Phil Hageman wrote:

John, Thanks for your reply. I copy/pasted the code

into
the "This Workbook" module, but it doesn't work. There

is
no error message to hint of the problem either. Is

there
something I should look for?
Thanks, Phil
-----Original Message-----
Phil,

If, as you say, you want a standard set-up when the

user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will

run whenever
the workbook is opened and insure that "Scorecard" is

the
active sheet
and that cell "A1" is the active cell on all the

sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets

are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the

cursor in
each worksheet to be placed in Cell A1, and the

worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens

the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor

to
cell A1.

Thanks, Phil

.


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Need Before_Save code

Trevor,

I need to "think" array more often.
Your way makes it much cleaner and more straightforward.

Thanx,
John

Trevor Shuttleworth wrote:

Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor

"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will run whenever
the workbook is opened and insure that "Scorecard" is the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor in
each worksheet to be placed in Cell A1, and the worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up first,
and as each of the other worksheets is opened, it shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Need Before_Save code

Phil,

The "ThisWorkbook" module is where the workbook "Event" code
is placed. With the ThisWorkbook module open, click the left
dropdown and select workbook and in the right dropdown, you can
see all of the events.
There are Sheet Modules too for coding the events specific to the
individual sheets.
Regular modules are for general coding for use anywhere in the
workbook.

Having said the above, were you to take the code that I gave
you (actually, use Trevors as it's more concise) and place it
in the Workbook_Open Event, (in the "ThisWorkbook" module,
it would work there too.

Example:

Private Sub Workbook_Open()
' Trevor's code
Application.ScreenUpdating = False
Worksheets(Array("Employee", "Customer", "Finance", "Scorecard")).Select

Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

John

Phil Hageman wrote:

Thanks, John - it works perfectly. A final question:
what is the difference between using "ThisWorkbook", and a
new "Module1"?
-----Original Message-----
Phil,

It shouldn't go in the "ThisWorkbook" module.
Right click on "ThisWorkbook" in the "Projects" window
and then choose "Insert/Module".
Paste it into the module that appears to the right.

John

Phil Hageman wrote:

John, Thanks for your reply. I copy/pasted the code

into
the "This Workbook" module, but it doesn't work. There

is
no error message to hint of the problem either. Is

there
something I should look for?
Thanks, Phil
-----Original Message-----
Phil,

If, as you say, you want a standard set-up when the

user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will
run whenever
the workbook is opened and insure that "Scorecard" is

the
active sheet
and that cell "A1" is the active cell on all the

sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets

are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the

cursor in
each worksheet to be placed in Cell A1, and the
worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens

the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor

to
cell A1.

Thanks, Phil

.


.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Need Before_Save code

Phil,

Trevor's code should cure this.
I used the .Activate as opposed to the .Select
as Trevor did.
That should cure the problem.

John

Phil Hageman wrote:

John,

A new wrinkle - this code does indeed put the cursor in
A1, but you cant see cell A1, rather, it still shows
wherever the user left it when closing. How can I get the
screen to show cell A1?

Thanks, Phil
-----Original Message-----
Phil,

It shouldn't go in the "ThisWorkbook" module.
Right click on "ThisWorkbook" in the "Projects" window
and then choose "Insert/Module".
Paste it into the module that appears to the right.

John

Phil Hageman wrote:

John, Thanks for your reply. I copy/pasted the code

into
the "This Workbook" module, but it doesn't work. There

is
no error message to hint of the problem either. Is

there
something I should look for?
Thanks, Phil
-----Original Message-----
Phil,

If, as you say, you want a standard set-up when the

user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will
run whenever
the workbook is opened and insure that "Scorecard" is

the
active sheet
and that cell "A1" is the active cell on all the

sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets

are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the

cursor in
each worksheet to be placed in Cell A1, and the
worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens

the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor

to
cell A1.

Thanks, Phil

.


.


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Need Before_Save code

Trevpr and John,
Used the Array code - it puts the cursor in A1,
and "Scorecard" is the active worksheet, but in all
worksheets, the scroll does not put the document where A1
is visible. To test, I put the cursor at the end of each
worksheet - that is what is visible when opening.

Is there a scroll instruction to use?
Phil

-----Original Message-----
Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array

("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will

run whenever
the workbook is opened and insure that "Scorecard" is

the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor

in
each worksheet to be placed in Cell A1, and the

worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil





.

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Need Before_Save code

Trevpr and John,
Used the Array code - it puts the cursor in A1,
and "Scorecard" is the active worksheet, but in all
worksheets, the scroll does not put the document where A1
is visible. To test, I put the cursor at the end of each
worksheet - that is what is visible when opening.

Is there a scroll instruction to use?
Phil
-----Original Message-----
Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array

("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will

run whenever
the workbook is opened and insure that "Scorecard" is

the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor

in
each worksheet to be placed in Cell A1, and the

worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil





.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Need Before_Save code

Phil,

Now I think I see what you're after.

The following is the long way of doing this (I'm sure there's
a more concise way), but it should do what you want:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Customer").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Finance").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Application.ScreenUpdating = True
End Sub

John

Phil Hageman wrote:

Trevpr and John,
Used the Array code - it puts the cursor in A1,
and "Scorecard" is the active worksheet, but in all
worksheets, the scroll does not put the document where A1
is visible. To test, I put the cursor at the end of each
worksheet - that is what is visible when opening.

Is there a scroll instruction to use?
Phil
-----Original Message-----
Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array

("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will

run whenever
the workbook is opened and insure that "Scorecard" is

the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor

in
each worksheet to be placed in Cell A1, and the

worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil




.


  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Need Before_Save code

John

a concise way ? ;-) Sure there's better (and probably shorter)

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

Now I think I see what you're after.

The following is the long way of doing this (I'm sure there's
a more concise way), but it should do what you want:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Customer").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Finance").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Application.ScreenUpdating = True
End Sub

John

Phil Hageman wrote:

Trevpr and John,
Used the Array code - it puts the cursor in A1,
and "Scorecard" is the active worksheet, but in all
worksheets, the scroll does not put the document where A1
is visible. To test, I put the cursor at the end of each
worksheet - that is what is visible when opening.

Is there a scroll instruction to use?
Phil
-----Original Message-----
Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array

("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will

run whenever
the workbook is opened and insure that "Scorecard" is

the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor

in
each worksheet to be placed in Cell A1, and the

worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up

first,
and as each of the other worksheets is opened, it

shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil




.




  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Need Before_Save code

Trevor,

Yep, that'll do it.
Was concentrating on using the sheet names theat the OP was using
but for what he wanted to do, cycling through all sheets the way you
suggest is better.
The only named sheet that needed to be referenced was the one that
he wanted visible all the time.

John

Trevor Shuttleworth wrote:

John

a concise way ? ;-) Sure there's better (and probably shorter)

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor

"John Wilson" wrote in message
...
Phil,

Now I think I see what you're after.

The following is the long way of doing this (I'm sure there's
a more concise way), but it should do what you want:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Customer").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Finance").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Application.ScreenUpdating = True
End Sub

John

Phil Hageman wrote:

Trevpr and John,
Used the Array code - it puts the cursor in A1,
and "Scorecard" is the active worksheet, but in all
worksheets, the scroll does not put the document where A1
is visible. To test, I put the cursor at the end of each
worksheet - that is what is visible when opening.

Is there a scroll instruction to use?
Phil
-----Original Message-----
Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array
("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in message
...
Phil,

If, as you say, you want a standard set-up when the user
"opens" the workbook, a simple way would be as follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular module, will
run whenever
the workbook is opened and insure that "Scorecard" is
the active sheet
and that cell "A1" is the active cell on all the sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its worksheets are
entitled Scorecard, Customer, Finance, and Employee.

When the user clicks the Save icon, I want the cursor
in
each worksheet to be placed in Cell A1, and the
worksheet
named Scorecard to be the the last worksheet changed.

The object is that when a another user first opens the
Workbook, the worksheet named Scorecard comes up
first,
and as each of the other worksheets is opened, it
shows
the top of the worksheet - thus the force of cursor to
cell A1.

Thanks, Phil




.



  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Need Before_Save code

IT WORKS PERFECTLY!!! Thanks guys for taking so much time
with this. One thing about this code - it's so easily
transportable to any workbook. Again, thank you. Phil
-----Original Message-----
Trevor,

Yep, that'll do it.
Was concentrating on using the sheet names theat the OP

was using
but for what he wanted to do, cycling through all sheets

the way you
suggest is better.
The only named sheet that needed to be referenced was the

one that
he wanted visible all the time.

John

Trevor Shuttleworth wrote:

John

a concise way ? ;-) Sure there's better (and probably

shorter)

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor

"John Wilson" wrote in message
...
Phil,

Now I think I see what you're after.

The following is the long way of doing this (I'm sure

there's
a more concise way), but it should do what you want:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Customer").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Finance").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.Goto ActiveCell, True
Application.ScreenUpdating = True
End Sub

John

Phil Hageman wrote:

Trevpr and John,
Used the Array code - it puts the cursor in A1,
and "Scorecard" is the active worksheet, but in all
worksheets, the scroll does not put the document

where A1
is visible. To test, I put the cursor at the end

of each
worksheet - that is what is visible when opening.

Is there a scroll instruction to use?
Phil
-----Original Message-----
Or:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets(Array

("Employee", "Customer", "Finance", "Scorecard")).Select
Range("A1").Select
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"John Wilson" wrote in

message
...
Phil,

If, as you say, you want a standard set-up when

the user
"opens" the workbook, a simple way would be as

follows:

Sub Auto_Open()
Application.ScreenUpdating = False
Worksheets("Employee").Activate
Range("A1").Activate
Worksheets("Customer").Activate
Range("A1").Activate
Worksheets("Finance").Activate
Range("A1").Activate
Worksheets("Scorecard").Activate
Range("A1").Activate
Application.ScreenUpdating = True
End Sub

The above macro, when placed in a regular

module, will
run whenever
the workbook is opened and insure

that "Scorecard" is
the active sheet
and that cell "A1" is the active cell on all the

sheets.

John

Phil Hageman wrote:

My workbook is named Scorecard, and its

worksheets are
entitled Scorecard, Customer, Finance, and

Employee.

When the user clicks the Save icon, I want the

cursor
in
each worksheet to be placed in Cell A1, and the
worksheet
named Scorecard to be the the last worksheet

changed.

The object is that when a another user first

opens the
Workbook, the worksheet named Scorecard comes

up
first,
and as each of the other worksheets is opened,

it
shows
the top of the worksheet - thus the force of

cursor to
cell A1.

Thanks, Phil




.



.

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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Problem with Before_Save Macro Jay Excel Discussion (Misc queries) 5 May 18th 06 06:47 PM


All times are GMT +1. The time now is 06:27 PM.

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

About Us

"It's about Microsoft Excel"