Ctrl + Home

B

Bruce Roberson

I am used to the "ctrl + home" key combination taking me
to the cell A1 of sheet A. In Excel, it only takes you to
the cell A1 of the sheet you are in at the time.

Is there another key combination that takes the place of
Ctrl + Home in QPW and takes you to Cell A1 in the Sheet A
or do I need to program that into a macro and stick it on
a toolbar somewhere?

Thanks,


Bruce
 
J

Jim Rech

There is no built-in shortcut to take you to the first worksheet's cell A1.
You could, of course, press Ctrl-PgUp a number of times to get to the first
worksheet, and then press Ctrl-Home.

The code for your macro could be as simple as this:

Application.Goto Worksheets(1).Range("A1")
 
D

Dave Peterson

Many people have these kinds of utility macros in their personal.xls (or
personal.xla) workbook. The put this workbook into a special folder (XLStart).
Files in this folder get started each time excel starts.

But if you're going to share this kind of functionality with others, stay away
from the name personal.xl*. You don't want to overwrite any personalized macros
that your coworkers already have (or will have).

So call that workbook BruceUtils.xls (or .xla if you save it as an addin).

Then it can co-exist with the user's personal.xl* file.

And once you get a few of these utilities, you may want to make them available
on another option on the worksheet menubar.

I really like John Walkenbach's menumaker program. It's easy to update and
looks very nice.
http://j-walk.com/ss/excel/tips/tip53.htm

And since you want to make it available all the time, you'll probably have to
add some checks. For instance, what happens if the first worksheet is hidden?

You could just ignore the error:

Option Explicit
Sub gotoWK1A1()
On Error Resume Next
Application.Goto ActiveWorkbook.Worksheets(1).Range("A1")
On Error GoTo 0
End Sub

Or you could try to think of all the things that could go wrong. (I didn't. I
just thought of Hidden worksheets and maybe no worksheets at all!)


Option Explicit
Sub gotoWK1A1()
Dim iCtr As Long
For iCtr = 1 To Worksheets.Count
If Worksheets(iCtr).Visible = xlSheetVisible Then
Application.Goto ActiveWorkbook.Worksheets(iCtr).Range("A1")
Exit Sub
End If
Next iCtr
MsgBox "Failed"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top