I'm working on a simple program that lets the user enter, edit and
print the data. I developed the program using Microsoft Excel 2003 with
VBE.
The problem is that, under Edit button I want to enable the user to
edit the existing data and save as well as to save as another name.
But, how to let the user delete the data in the worksheet?
Example :
When the user clicked on Delete button, an input box will appear as to
ask which data to be deleted. When the user entered the name of the
file, it will automatically delete the entire data corresponding to the
filename.
There are 2 datas with 3 sub-datas in a worksheet named BOOK TABLE.
a)Data : Fish
Sub-data : Whale, Jelly fish, Jaws
b)Flower
Sub-data : Rose, Sunflower, Tulip
When the user asked to delete the data for Fish, it will automatically
erase all the data and sub-data.
Any ideas?
Thanks in advanced
glenton (glenton@leviqqio.com - 12 Sep 2006 12:02 GMT
a simple loop from the bottom of your data table to the top, deleting entire
rows when appropriate should do the trick.
something like
Sub delete()
MyDel = InputBox("Delete?")
For i = Range("a1:a10000").Count To 1 Step -1
If Cells(i + 3, "a") = MyDel Then
Cells(i + 3, "a").EntireRow.delete
End If
Next i
End Sub
Hope this helps
Glenton
> I'm working on a simple program that lets the user enter, edit and
> print the data. I developed the program using Microsoft Excel 2003 with
[quoted text clipped - 22 lines]
> Any ideas?
> Thanks in advanced
rixanna - 13 Sep 2006 04:31 GMT
Thank you sooo much..it really works.
Thanks a lot