Excel Oddities


Return to The Spreadsheet Page

Excel page

User tips

Developer tips

Excel FAQs

Excel files

Excel Expert E-Letter

Excel Help Resources

Excel links

Excel oddities

Excel books

Power Utility Pak for Excel


When a sheet turns into a button

Follow these steps:

  1. Start with a new workbook.
  2. Press Alt+F11 to activate the VB Editor.
  3. Insert a new VBA module, and enter this procedure:
     
    Sub SayHello()
        MsgBox "Hello!"
    End Sub

     
  4. Press Alt+F11 to return to your workbook.
  5. Right-click any toolbar and choose Forms (this displays the Forms toolbar).
  6. Use the Button icon on the Forms toolbar to add a button to the worksheet. Put the button somewhere near the upper left corner, around cell B2.
  7. When prompted, assign the SayHello procedure to the button. Click the button to ensure that it executes the macro.
  8. Right-click the button and choose Format Control. Click the Properties tab and make sure the 'Move and size with cells' option is selected.
  9. Select rows on the worksheet beginning with Row 1 to well past the button, and. choose Edit - Delete. The button will get sucked up to the top of the worksheet.  You can still detect a tiny sliver of the button if you look carefully, just below the column headings.
  10. Protect the worksheet. (use Tools - Protection, and accept the defaults.)

Now we enter the Twilight Zone of Excel...

Notice your mouse cursor -- it displays a hand, just like it does when it hovers over a button. Now try clicking in any cell on the worksheet. Doing so runs the macro attached to the button. Excel seems to think the button extends over the entire worksheet!

When you scroll down to reveal more cells, those cells behave normally.

(Contributed by Dan Evens)