• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

Excel: select cell without scrolling

What Vba would I use to select a cell on a worksheet without scrolling the screen

E.g., I have the following code: activesheet.cells(1,1).select. If I am on row 2000 running this code would skip my screen to the top. What vba would i need tod select cell "A1" without skipping to the top?
0
ouestque
Asked:
ouestque
3 Solutions
 
wshark83Commented:
activesheet.range("A1").select
0
 
ouestqueAuthor Commented:
Thank you whark, nonetheless If I move to row 10000 and run that code in the immediate window, the screen will skip to the top. I would like my screen to stay focused on row 10000 even though code selected cell "a1".
0
 
StephenJRCommented:
You almost certainly don't need to select the cell and then you won't have the problem. What are you trying to do?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ragnarok89Commented:
application.screenupdating = false
range("A1").select

Alex
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Hello,

If you use Select, regardless of whether you use activesheet.cells(1,1).select or activesheet.range("A1").select ( as suggested above),  the cell will be highlighted and the selection will shift to that cell.

In many cases, you don't need to actually "select" the cell to manipulate it.

"Select" is not required.

What do you want to do with the cell? It can be done without selecting it.

To change the font color, for example, you could use Select like

    Range("A1").Select
    With Selection.Font
        .Color = -16776961
        .TintAndShade = 0
    End With

Open in new window


But you can change the font color without selecting if you use

    With Range("A1").Font
        .Color = -16776961
        .TintAndShade = 0
    End With

Open in new window


The same outcome, but without selecting and shifting the focus of the sheet.

cheers, teylyn
0
 
Saqib Husain, SyedEngineerCommented:
Maybe this will work

Sub a()
Dim sr As Long, sc As Long
sr = ActiveWindow.ScrollRow
sc = ActiveWindow.ScrollColumn
Range("A1").Select
ActiveWindow.ScrollRow = sr
ActiveWindow.ScrollColumn = sc
End Sub
0
 
StephenJRCommented:
ssaqibh - very neat.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now