If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > How do you programmatically add a control to delete said row OnClick?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-10-05, 16:59
klakringb klakringb is offline
Registered User
 
Join Date: Aug 2004
Location: St Petersburg, FL
Posts: 5
How do you programmatically add a control to delete said row OnClick?

I have an Excel spreadsheet that is created from an Ado recordset in Access. The spreadsheet contains 1 row per mailing address. The idea is to have customer service folks scan this list of their clients for people they DO NOT want to send to, and eliminate them (delete the row) by clicking on some sort of control.

In other words, I need a delete control of some sort on every row with data that deletes itself and its row.

Any ideas would be appreciated! Thanks in advance!

Brian Klakring
Reply With Quote
  #2 (permalink)  
Old 02-11-05, 10:31
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Howdy!

Sounds like a UserForm might be the way to go. Here is an example/discussion about how to do that:

UserForm example to add/delete
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 02-11-05, 11:36
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
When ive done this kind of thing before it becomes notroiously difficult to control,
my advice would be to have a column that the user can double click in to delete the said row using the
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    
End Sub
event

Dave
Reply With Quote
  #4 (permalink)  
Old 02-11-05, 16:21
klakringb klakringb is offline
Registered User
 
Join Date: Aug 2004
Location: St Petersburg, FL
Posts: 5
Thanks for the good advice!

Thanks for your help! I've gotten past that issue satisfactorily.

I ended up adding a field to the ADO recordset that populates the worksheet with a column of "DELETE". Then I added the following code to the worksheet...

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Delete row if user double-clicks on "Delete"

If Target.Value = "Delete" Then
Target.EntireRow.Delete
End If

End Sub

Simple and effective.

Again, thank you both for your help!

Brian
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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