Delete selected data in Excel 2007

Closed
JS Desai Posts 4 Registration date Saturday October 26, 2013 Status Member Last seen October 28, 2013 - Oct 27, 2013 at 01:38 AM
JS Desai Posts 4 Registration date Saturday October 26, 2013 Status Member Last seen October 28, 2013 - Oct 28, 2013 at 08:38 AM
Attached a link which will give the details

http://speedy.sh/bQWZM/OutletsCode.xlsm

thanks
JS Desai

2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Oct 28, 2013 at 12:14 AM
download the file from
http://speedy.sh/YDgBb/desai-131027.xlsm

1.your bank id data is copied to another sheet called "bookid original"
2. I have deleted the data in bankid
3. I have copied the data in stock to a new sheet "stock original" kto preserve the data

right click the tab ofsheet bankid (at the bottom name of sheet is called tab)-not any other sheet
and click view code
in thewindow that comes up copy this EVENT CODE

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cfind As Range, r As Range, x
Worksheets("stock").Cells.Clear
Worksheets("stock original ").Cells.Copy Worksheets("stock").Range("a1")
If Target.Column <> 1 Then Exit Sub
On Error GoTo enableevents
Application.enableevents = False
x = Target.Value
With Worksheets("stock")
Set r = .Range(.Range("A1"), .Range("a1").End(xlDown))
Set cfind = r.Find(what:=x, lookat:=xlWhole)
If Not cfind Is Nothing Then
.Range(cfind.Offset(0, 1), cfind.End(xlToRight)).Cells.Clear

End If
End With
Cells.Clear
Range("a1").Select
enableevents:
Application.enableevents = True


End Sub
now go to sheet "bankid" and type any of the number in COLUMN A of the bankid original or anyother number and hit enter key. see what happens to "stock" sheet
as a first example type in THIS SHEet 9755672
in A1 or any cell in column A of THIS SHEET.

CONFIRM WHETHER YOU GOT WHAT YOU WANT.
0
JS Desai Posts 4 Registration date Saturday October 26, 2013 Status Member Last seen October 28, 2013
Oct 28, 2013 at 08:38 AM
Hello Venkat
Thanks for the reply.
I checked the operating.

1) It delets only one entry and not multiple.
for eg. in BranchId sheet as I enter one number
the data gets deleted. But as I enter another number, its
data gets deleted but the previous number data re-appears.

2) Also I have to recheck. Probably the BranchId sheet
does not accept group of numbers. If you copy paste group of
numbers togather ( as pasted in branchid original sheet )
then it delets the data of the first number only.

Probably a small change somewhere in the code required.

thanks
JS Desai
0