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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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
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
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,213,483
Messages
6,113,919
Members
448,533
Latest member
thietbibeboiwasaco

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
Back
Top