SOLVED

Macros and VBA

%3CLINGO-SUB%20id%3D%22lingo-sub-1934881%22%20slang%3D%22en-US%22%3EMacros%20and%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1934881%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20move%20a%20specified%20row%20to%20the%20top%20of%20the%20screen.%20This%20seems%20to%20be%20easy%20enough%20but%20when%20I%20%22select%22%20a%20cell%20that%20I%20want%20to%20be%20on%20top%2C%20it%20appears%20somewhere%20else.%20Even%20when%20I%20just%20page%20down%20(several%20times)%20and%20page%20up%2C%20the%20screen%20changes%20so%20what%20was%20the%20top%20most%20row%20is%20no%20longer%20the%20one%20on%20top.%26nbsp%3B%20I%20could%20use%20%22Freeze%20Frames%22%20but%20then%20I%20would%20have%20to%20add%20this%20many%20times%20to%20my%20macros.%20I%20was%20hoping%20there%20is%20an%20easier%20way%20to%20do%20this.%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EFrank%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1934881%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1934900%22%20slang%3D%22en-US%22%3ERe%3A%20Macros%20and%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1934900%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F158878%22%20target%3D%22_blank%22%3E%40Frank%20Drucker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20Application.GoTo%20with%20True%20as%20second%20argument.%20For%20example%2C%20to%20scroll%20cell%20A20%20on%20the%20active%20sheet%20to%20the%20top%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EApplication.Goto%20Range(%22A20%22)%2C%20True%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIt%20even%20works%20with%20a%20cell%20on%20another%20sheet.%20That%20sheet%20will%20be%20activated.%20To%20scroll%20cell%20A20%20on%20Sheet2%20to%20the%20top%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EApplication.Goto%20Worksheets(%22Sheet2%22).Range(%22A20%22)%2C%20True%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1934977%22%20slang%3D%22en-US%22%3ERe%3A%20Macros%20and%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1934977%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20worked.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20help.%3C%2FP%3E%3CP%3EFrank%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I'm trying to move a specified row to the top of the screen. This seems to be easy enough but when I "select" a cell that I want to be on top, it appears somewhere else. Even when I just page down (several times) and page up, the screen changes so what was the top most row is no longer the one on top.  I could use "Freeze Frames" but then I would have to add this many times to my macros. I was hoping there is an easier way to do this.

Thanks,

Frank

2 Replies
best response confirmed by Frank Drucker (Occasional Contributor)
Solution

@Frank Drucker 

You can use Application.GoTo with True as second argument. For example, to scroll cell A20 on the active sheet to the top:

Application.Goto Range("A20"), True

It even works with a cell on another sheet. That sheet will be activated. To scroll cell A20 on Sheet2 to the top:

Application.Goto Worksheets("Sheet2").Range("A20"), True

@Hans Vogelaar 

That worked. 

 

Thanks for your help.

Frank