Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find and delete rows macro | Excel Discussion (Misc queries) | |||
find last record in macro and delete all after | Excel Discussion (Misc queries) | |||
Macro to find and delete rows! | Excel Discussion (Misc queries) | |||
Can't find macro in an Excel file to delete it | Excel Discussion (Misc queries) | |||
Macro to find row and delete it | Excel Programming |