Tidying up a large Woorkbook

BallGazer

Board Regular
Joined
Jul 16, 2008
Messages
110
Hi Guys

can someone help me out with a little VBA?

I have a very large Workbook (55 sizeable pages). A number of people in offices around the World need to contribute to this model. When each of them have completed their bit I would like the model left in a tidy fashion for the next contributor. I am trying to write some VBA as a "Before_Close" module to cycle though all the sheets in the model and "park" the active cell at ("A1"). I don't believe this should be difficult but it is stretching my clapped out brain!

Any help greatly appreciated.

Regards

BG

:confused:
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
    Application.Goto reference:=ws.Range("A1"), scroll:=True
Next ws
Application.ScreenUpdating = True
End Sub
 
Upvote 0

BallGazer

Board Regular
Joined
Jul 16, 2008
Messages
110
Thanks for the suggestion. Unfortunately I get an error on

Application.Goto reference:=ws.Range("A1"), scroll:=True

Error code 1004 (what ever that is!)
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Hidden sheet(s)? If so try

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
    If ws.Visible = xlSheetVisible Then
        Application.Goto reference:=ws.Range("A1"), scroll:=True
    End If
Next ws
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,195,695
Messages
6,011,173
Members
441,591
Latest member
elmogm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top