move all sheets with scroll button on top

spilner

Board Regular
Joined
Jun 7, 2011
Messages
146
hi,i have hundreds of sheets.some sheets is on bottom.
i try to select all sheets and press CTRL HOME.just the square cursor is on top.
i want the scroll button is follow on top too.
any idea? thanks a lot
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
when i use CTRL home.the cursor will be in A1.
but the screen not moving too.
the screen still show me in bottom but the cursor is at A1.
i want the screen is moving on top too.thanks
 
Upvote 0
Put this code into a new module

Code:
Public Sub SetA1Active()
Dim mysheet As Worksheet
Dim r As Long, c As Long
For Each mysheet In Worksheets
    r = 0: c = 1
 
    'Debug.Print mysheet.Name
    mysheet.Activate
    Do
        r = r + 1
        mysheet.Range(Cells(r, c).Address).Select
    Loop Until Selection.Rows.Hidden = False
        c = 0
    Do
        c = c + 1
        mysheet.Range(Cells(r, c).Address).Select
    Loop Until Selection.Columns.Hidden = False
 
Next mysheet
 
End Sub

save

and the run the macro
SetA1Active

it activates cell A1 on every sheet in a workbook, if it's not hidden else it activates the next closest non hidden cell to it
 
Upvote 0
work perfect.it just takes sometime to finish as i have almost thousand of sheets.thanks man
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,152
Members
452,891
Latest member
JUSTOUTOFMYREACH

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