de-select the whole sheet

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I can select the hole sheet by clicking on the icon on top left corner. How can I deselect a sheet with out clicking on any cell? the reason I want to know because I am recording macro that will select and delete the whole sheet then deselect.

Thank you
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I don't think you can be on a sheet and not have at least one cell selected.
The default typically is A1.
If you want to totally de-select, move to another sheet.

Why do you think you need to totally de-select anyway?
 
Upvote 0
I want to create a control button to clear the content of all sheet. So I recorded a macro, selected the whole sheet, then click on Delete, then ??? here I want to deselect and stop recording. Thank you so much.
 
Last edited:
Upvote 0
This is the only line of VBA code you need to clear all the contents from the active sheet. No need to select or de-select anything.
Code:
    Cells.ClearContents
 
Last edited:
Upvote 0
That is right but I am still not familiar with VBA, so I want to get the code from recording the Macro. Time to learn VBA I guess :) thank you so much
 
Upvote 0
The Macro Recorder is a great tool, especially for beginners. But there are a few things to keep in mind using it:
- there are certain functions/commands it cannot record (i.e. you can record a "loop")
- it is very literal (with "Selects" and "Scrolls", so some clean-up may be necessary to make your code efficient)
- it may not always record the most efficient ways of doing things (basically, it just records whatever you are doing manually)
 
Upvote 0

Forum statistics

Threads
1,215,123
Messages
6,123,183
Members
449,090
Latest member
bes000

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