?
Solved

Excel: select cell without scrolling

Posted on 2012-04-12
7
Medium Priority
?
429 Views
Last Modified: 2012-04-13
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
Comment
Question by:ouestque
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Expert Comment

by:wshark83
ID: 37837499
activesheet.range("A1").select
0
 

Author Comment

by:ouestque
ID: 37837523
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
 
LVL 24

Expert Comment

by:StephenJR
ID: 37837538
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Accepted Solution

by:
ragnarok89 earned 668 total points
ID: 37837544
application.screenupdating = false
range("A1").select

Alex
0
 
LVL 50

Assisted Solution

by:Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 664 total points
ID: 37837546
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
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 668 total points
ID: 37837676
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
 
LVL 24

Expert Comment

by:StephenJR
ID: 37837882
ssaqibh - very neat.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question