Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I add button to cell to easily view all data in cell? Geekwanabe Excel Discussion (Misc queries) 1 February 26th 09 05:39 PM
Transfer cell values to another cell by selecting button. Gryndar Excel Worksheet Functions 2 November 24th 08 02:21 AM
Excel - create button to replace cell content with cell value blackmot Excel Worksheet Functions 3 December 7th 05 05:10 PM
Control Cell Link for Option Button based on value in a cell arunjoshi[_14_] Excel Programming 1 May 5th 04 02:19 AM
Control Cell Link for Option Button based on value in a cell arunjoshi[_13_] Excel Programming 0 May 4th 04 05:46 AM


All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"