Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put a button in a cell
I need a way to put a button in a specific cell (not a button that
floats) that deletes the row that it is on when pressed, from VBA (since I need to do this iteratively). Is there a way to do it? Thanks... -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put a button in a cell
Put the button where you want it then, while in design mode, right-click the
button and select Format Control. On the Properties tab, select "Don't move or size with cells" to cause to button to remain in position regardless of the adding or deleting of cells. HTH Mike. "Christopher Benson-Manica" wrote in message ... I need a way to put a button in a specific cell (not a button that floats) that deletes the row that it is on when pressed, from VBA (since I need to do this iteratively). Is there a way to do it? Thanks... -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put a button in a cell
Michael Malinsky spoke thus:
Put the button where you want it then, while in design mode, right-click the button and select Format Control. On the Properties tab, select "Don't move or size with cells" to cause to button to remain in position regardless of the adding or deleting of cells. Hm... I guess my original post wasn't really clear. I need a button (or something else!) that fits inside a cell completely and deletes the row it's on (as well as itself) when clicked. It needs to be inside a cell, because I want one of these for each row on a worksheet, including rows not currently visible... I appreciate your help, and I hope I'm being more clear this time. :) -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put a button in a cell
I feel I should respond so you don't think I'm ignoring you, but I don't
think I have an answer for you. My only thought would be to ask why not add the "Delete Row" button on the toolbar? "Christopher Benson-Manica" wrote in message ... Michael Malinsky spoke thus: Put the button where you want it then, while in design mode, right-click the button and select Format Control. On the Properties tab, select "Don't move or size with cells" to cause to button to remain in position regardless of the adding or deleting of cells. Hm... I guess my original post wasn't really clear. I need a button (or something else!) that fits inside a cell completely and deletes the row it's on (as well as itself) when clicked. It needs to be inside a cell, because I want one of these for each row on a worksheet, including rows not currently visible... I appreciate your help, and I hope I'm being more clear this time. :) -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put a button in a cell
Michael Malinsky spoke thus:
I feel I should respond so you don't think I'm ignoring you, but I don't think I have an answer for you. My only thought would be to ask why not add the "Delete Row" button on the toolbar? Well, I'd actually like to call a sub that does some other stuff in addition to deleting the row... I got the impression that I wouldn't be able to do what I wanted, so I put one button in that deletes rows depending on what's in them instead. But thanks for your help - I didn't know the button you spoke of existed :) -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put a button in a cell
Try this against a copy of your worksheet--just in case:
Option Explicit Sub AddButtons() Dim myRng As Range Dim myCell As Range Dim wks As Worksheet Dim myBTN As Button Set wks = ActiveSheet With wks .Buttons.Delete 'remove existing buttons??? Set myRng = .Range("a1:a10") For Each myCell In myRng.Cells With myCell Set myBTN = .Parent.Buttons.Add _ (Height:=.Height, _ Width:=.Width, _ Left:=.Left, _ Top:=.Top) myBTN.Name = "BTN_" & .Address(0, 0) myBTN.OnAction = ThisWorkbook.Name & "!myBTNmacro" myBTN.Caption = "Click Me" End With Next myCell End With End Sub Sub myBTNMacro() Dim myBTN As Button Set myBTN = ActiveSheet.Buttons(Application.Caller) With myBTN .TopLeftCell.EntireRow.Delete .Delete End With End Sub Christopher Benson-Manica wrote: Michael Malinsky spoke thus: Put the button where you want it then, while in design mode, right-click the button and select Format Control. On the Properties tab, select "Don't move or size with cells" to cause to button to remain in position regardless of the adding or deleting of cells. Hm... I guess my original post wasn't really clear. I need a button (or something else!) that fits inside a cell completely and deletes the row it's on (as well as itself) when clicked. It needs to be inside a cell, because I want one of these for each row on a worksheet, including rows not currently visible... I appreciate your help, and I hope I'm being more clear this time. :) -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I add button to cell to easily view all data in cell? | Excel Discussion (Misc queries) | |||
Transfer cell values to another cell by selecting button. | Excel Worksheet Functions | |||
Excel - create button to replace cell content with cell value | Excel Worksheet Functions | |||
Control Cell Link for Option Button based on value in a cell | Excel Programming | |||
Control Cell Link for Option Button based on value in a cell | Excel Programming |