ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Empty selection with vba (https://www.excelbanter.com/excel-programming/416679-empty-selection-vba.html)

VBA beginner

Empty selection with vba
 
How can I hide the selected cell? For example, if I have selected one cell
and my VBA code execution ends and I don't want that the last selected cell
is selected anymore. How can I do it with VBA?

Mike H

Empty selection with vba
 
Maybe

Range("A1").Activate

Mike

"VBA beginner" wrote:

How can I hide the selected cell? For example, if I have selected one cell
and my VBA code execution ends and I don't want that the last selected cell
is selected anymore. How can I do it with VBA?


Jim Rech

Empty selection with vba
 
Something is always 'selected' in a worksheet, so if you don't like the
current selection you have to select something else, as Mike demonstrated.
Btw though, most actions can be performed in VBA without changing the
selection. New coders often write:

Range("A1").Select
ActiveCell.Font.Bold = True

but all that's needed is:

Range("A1").Font.Bold = True

--
Jim
"VBA beginner" <VBA wrote in message
...
| How can I hide the selected cell? For example, if I have selected one cell
| and my VBA code execution ends and I don't want that the last selected
cell
| is selected anymore. How can I do it with VBA?



All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com