LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default URGENT! Find and delete row macro

Hi all, I posted a thread similar to this a few days ago but it did no
yield the perfect results :(

After a long search on google, I came across some code on the M
website, and I modified it to my needs.

This is my code as it stands now:


Code
-------------------


Sub DelCustomer()

Sheets("Database").Select
testValue = InputBox("Enter the customer's user ID to delete")
For Each x In ActiveWindow.SelectedSheets
x.Select
Set foundcell = ActiveSheet.Cells.Find(testValue)
If foundcell Is Nothing Then
MsgBox "The customer was not found"
Else
MsgBox "The customer was found"
Range(foundcell.Address).Select

LookAgain:
response = MsgBox _
("Delete this customer?", vbYesNo)

' If response = 6, we will not continue searching on
' this sheet.
If response = 6 Then

' Part2
Set foundcell = _
Range(foundcell.Address).Select
Selection.Delete Shift:=xlUp

End If

If response = 7 Then
response = MsgBox("Cancel search ? ", vbYesNo)
If response = 6 Then End
GoTo NextSheet
End If
End If

NextSheet:
Next x
MsgBox "Search is complete ....."

End Sub



-------------------


Currently, the search works and it selects the cell correctly. However
when I tried to add my own line of code to delete the row, I was no
successful. What I am asking for help on is to select the cell, the
use that to select the row. Then delete that row.

I am very pressed for time (like 3 hours or so) so this is greatl
appreciated. Thanks!!

--
Message posted from http://www.ExcelForum.com

 
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
find and delete rows macro clayton ledford Excel Discussion (Misc queries) 4 January 20th 09 03:34 PM
find last record in macro and delete all after Sherife Excel Discussion (Misc queries) 3 September 18th 06 03:51 AM
Macro to find and delete rows! Heather O'Malley Excel Discussion (Misc queries) 2 April 12th 06 01:53 PM
Can't find macro in an Excel file to delete it Ron Excel Discussion (Misc queries) 3 July 1st 05 01:07 PM
Macro to find row and delete it Piet Lauwen Excel Programming 1 January 18th 04 07:49 PM


All times are GMT +1. The time now is 03:33 AM.

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

About Us

"It's about Microsoft Excel"