Unable to select individual cells when in vba break mode

davidam

Active Member
Joined
May 28, 2010
Messages
474
Office Version
  1. 2021
Platform
  1. Windows
Hello All,
While constructing a procedure, I use 'Stop' in order to break execution and then step through subsequent lines in the program. Sometimes when I do this, the worksheet seems to anchor on one cell such that if I select another cell then an array, cornered by the original cell and the newly selected cell, will be selected. Has anyone else seen this? Any ideas on what causes it? When I type a different cell address in the cell address bar it returns to normal.
Thanks,
David
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
David

This behavior could be connected to the code you are running, can you post the code?
 
Upvote 0
Hi Norie,
The program is pretty big and I am not sure where I was when I last saw the behaviour. I can say without any doubt, however, that the code did not call for any selecting. (I have been well schooled on the folly of unnecessarily selecting ranges by this forum!).
 
Upvote 0
Why are you selecting cells when code execution has been interrupted?
 
Upvote 0
The code is acting on different parts of the sheet and I want to move around so that I can see what is happening...I know I could do this programically but it is quicker just to do it myself sometimes.
 
Upvote 0
If you want to move around the sheet use the scroll bars.
 
Upvote 0
I looked through the code and found one place where the code selected the 'anchor' cell. I wonder if VBA treats a cell selection like a shift-select, rather than just a select. If so it would account for this behavior, because a normal selection would be released as soon as another cell is selected.
 
Upvote 0
I looked through the code and found one place where the code selected the 'anchor' cell. I wonder if VBA treats a cell selection like a shift-select, rather than just a select. If so it would account for this behavior, because a normal selection would be released as soon as another cell is selected.
No, that is not how it works in VBA. If you did something like this in code, you could create the effect you are seeing though...

Rich (BB code):
' Select the anchor cell
Range("C5").Select
...
...  {later on in your code}
...
' Assuming H9 is a new cell to be selected
Range(Selection, Range("H9")).Select

Of course, without being able to see your actual code, all we can do is guess here.
 
Upvote 0
I think it is a bug, not the code. It happens occasionally and it is an annoyance more than anything. If I type a new cell address in the name bar, it stops doing it. Just wondered if others had seen it.
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top