• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Selecting a cell/range without moving the view to it?

Nightlytic

Member
Hi,

Is there any way in VBA to select a cell but not change the display, so to say if my display for the resolution and size is showing be columns A:Z with A1 being in top left corner (I physically can't see AA1 on my computer screen), but I do range("AA1").select or .activate, it moves the view so AA1 is within my view and the top left corner is now B1. I don't want it to do that. I want to select AA1 but still view columns A:Z as I did before that.

To explain my end objective: I have a bunch of macros here and there that use .select or .activate (maybe for good reason, maybe not so!) and I find it annoying that when I store the current selection (at start of macro) then return to I (at end of procedure) it also flickers the screen. Now, if there is a way to store which cell is in top left corner and adjust back to that, that'd be one way to fix it too. Can't find anything on this on the web, maybe I'm the only one bothered by it.

Thanks
 
In about 99.9% of case, you don't need select or activate in your code.

One of few exceptions are when you need to work with charts and shapes.
 
Hi !

Yes, a good code does not need to select anything !
Directly working with objects is the more efficient,
just see many samples in threads of this forum or
everywhere on Web like in VBA inner help as well …
 
Is there no way though to just not change view but keep the selects?

TBH I know it's out of ordinary but I sometimes allow the macro to scroll around, tends to aid understanding. For the most part though, I'd just like to add a small tweak to existing macros either I or others wrote that I don't want to troubleshoot all that much.
 
Probably there is, but not worth the effort.

If you want to, just re-select original cell to return view to original position at end of code.

But selects and activates slows down process and I tend to never use it, unless it's absolutely needed.
 
Back
Top