Solved

Excel: select cell without scrolling

Posted on 2012-04-12
7
336 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 8

Accepted Solution

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

Alex
0
 
LVL 50

Assisted Solution

by:Ingeborg Hawighorst
Ingeborg Hawighorst earned 166 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 167 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

776 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