Jump to content

Make cell in worksheet active

Recommended Posts

I have a script that uses the current selected cell of the top visible worksheet.


Once the script is done, is there a way to "reselect" the cell?  Keyboard input immediately after the script runs operates on the drawing itself, not any cell in the worksheet.


The dream goal is to select a cell, run a script, use the arrow keys to change cells, run another script.

Link to comment

Yes.  Sorry, I should have mentioned what I tried.  


I tried SetTopVisibleWS(h), SetSelect(h), and SetWSCurrentCell(h,currentCellRow,currentCellColumn).


Still when I run a script the next keyboard input is on the drawing, not the worksheet.

Link to comment

Pretty sure this is not possible as there is no VS procedure to change the focus and I think worksheet cell editing explicitly requires a click into a cell. I think you would need to use dialogs to enter your data and move to another cell, possibly with buttons to control which script is run next and other buttons to control the next cell to go to, etc. Not nearly as easy or workable though.

Link to comment

Actually one thing might work. If you run the script from a menu command, it might avoid removing focus from the worksheet, which is what clicking in a script palette is doing. You could use the RunScript command with a keyboard shortcut, then have your scripts in a folder if there is more than one. Alternatively create one or more .vsm's and put the script/s in that, then call them with keyboard shortcuts. If you do this, the only call you will need in the script is SetWSCurrentCell(h,currentCellRow,currentCellColumn);

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...