简体   繁体   中英

Hide/unhide specific cells

Is it possible to create a code that allows a button to hide specific cells (eg (B10:B15) + C17 + C19 + (D10:D18)) when pressed and then have the reappear when pressed again? Alternatively another button for the reapearing can be accepted.

You cannot hide a single cell. But if you want to hide/unhide eg a number of columns using a shortcut key you can do as follows:

  1. In the View toolbar, click Macros , then Record Macro... .
  2. Enter a key, under shortcut key ( Ctrl +... ). [Let's assume you put 'h'] Then press OK.
  3. Hide the columns you want to hide (or anything you want to happen by pressing the shortcut key).
  4. Goto View toolbar, click Macros , then Stop Recording .

Now when you press the defined shortcut key (eg Ctrl+h), the desired columns will hide.

You can follow the same steps to define a different shortcut key for unhiding.

If you want to make some single cells (kind of) invisible, you can do that by changing the font color to match the background color. Again you can use the same steps mentioned above to create a shortcut key for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM