Selection.Cells.Count = 0 -- Is this possible?

phantom1975

MrExcel MVP
Joined
Jun 3, 2002
Messages
3,962
I'm sure this is quite simple, but I am having a heck of a time finding the answer. I would like some code that would have zero cells selected. Here's an example of my heartache:


Code:
Range("A1:D4").Copy Range("F1:I4")
' UGH!  it sure looks ugly to have a bunch of cells selected!!!

Range("A1").Select
' Well, this is better, but I would prefer NO cells selected

Range("A1").Activate
' This does the same thing too!!!

Application.Goto Range("A1")
' So does this.

I guess I am looking for the equivalent of the ESC key to cancel out the CUTCOPYPASTE mode.

Help me Obi-wan Kenobi....you're my only hope.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi, Billy,

Currently working on a project, where I use this.
Code:
Sub DeSelect()
    With Application
    .ScreenUpdating = False
    .EnableEvents = False
    Range("Z12345").Select
    ActiveWindow.ScrollColumn = 1
    ActiveWindow.ScrollRow = 1
    .EnableEvents = True
    .ScreenUpdating = True
    End With
End Sub
kind regards,
Erik

PS: or did you really mean no cells selected?
then you will need an invisible shape to select
 
Upvote 0
That is a clever bit of code to accomplish the task. I have usually created a cell with a super tiny row height and column width to do the same. I am really hoping to select zero cells though. I want to avoid firing the SelectionChange event. I've got plenty of code, etc to do the job, but like your code suggests, it takes a few lines of code to accomplish what should be a relatively easy task.

Here's a bit of code that I use for the ScreenUpdating, etc.

Code:
Public Sub Trifecta(Status As Boolean)


    With Application
    
        .EnableEvents = Status
        .DisplayAlerts = Status
        .ScreenUpdating = Status
        
    End With
    
    Debug.Print "Trifecta Status:  " & Status
    

End Sub

Glad to hear from you again! Ecc 4:20 -- Observe the opportunity.
 
Upvote 0
and glad to answer you: never forgot that you were my first hero!!

nothing at all selected: then you can use
Code:
ActiveSheet.Shapes("MyShape").Select
works for me when placed outside view

the window will stay were it is
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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