ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Cell as Button (https://www.excelbanter.com/excel-discussion-misc-queries/42744-cell-button.html)

[email protected]

Cell as Button
 
I can add a button to my sheet, but it seems to float over the cells.
Can I add a button so that it is in a cell? Or, alternatively, change
a cell so that it looks and behaves like a button?

Thanks


Earl Kiosterud

Keyser,

Presumably, you want clicking the cell to activate some macro code. You can
use the Selection_Change event to make any cell act as a button. This goes
in a sheet module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Range("MyRange"), Target) Is Nothing Then
''' put your code here, or a call to it.
End If
End Sub

The best you can do to make it look like a button is Format - Cells -
Borders, and Fill colors and patterns. It won't be real obvious to the user
that it's a button. I generally put a real button inside the cell (assigned
to the macro), and label it in the cell.
--
Earl Kiosterud
www.smokeylake.com

wrote in message
oups.com...
I can add a button to my sheet, but it seems to float over the cells.
Can I add a button so that it is in a cell? Or, alternatively, change
a cell so that it looks and behaves like a button?

Thanks




[email protected]

I generally put a real button inside the cell (assigned
to the macro), and label it in the cell.

How do I accomlish this?


Earl Kiosterud

Keyser,

Take a look at "Consolidated Filtered table with sort.xls" at
http://www.smokeylake.com/excel/excel_truths.htm. There are buttons in the
heading that run sort macros.
--
Earl Kiosterud
www.smokeylake.com

wrote in message
oups.com...
I generally put a real button inside the cell (assigned

to the macro), and label it in the cell.

How do I accomlish this?





All times are GMT +1. The time now is 09:58 AM.

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