ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting data in userform and database (https://www.excelbanter.com/excel-programming/334371-deleting-data-userform-database.html)

Jennifer

Deleting data in userform and database
 
I found this code in the archives but it doesn't delete the data from the
database also. If the user accidentally makes a double entry i would like
them to be able to delete it or void it out. What would you suggest? I also
have a few formulas in the database and when the data is erased it tends to
mess the formulas up. Have any ideas for that also. Thank you, Jennifer
This is what i have so far.
With Me.ListBox1
.RemoveItem .ListIndex
End With

--
Though daily learning, I LOVE EXCEL!
Jennifer

Tom Ogilvy

Deleting data in userform and database
 
RemoveItem doesn't work if the list is bound to the data.

Since you say it works, then you must not be bound to data.

With Me.ListBox1
idx = .ListIndex + 1
.RemoveItem .ListIndex
End With

With Worksheets("Data")
.Range("A1").Offset(idex,0).Entirerow.Delete
End With

Assumes the data starts in row1 of the sheet named data with a header row

--
Regards,
Tom Ogilvy


"Jennifer" wrote in message
...
I found this code in the archives but it doesn't delete the data from the
database also. If the user accidentally makes a double entry i would like
them to be able to delete it or void it out. What would you suggest? I

also
have a few formulas in the database and when the data is erased it tends

to
mess the formulas up. Have any ideas for that also. Thank you, Jennifer
This is what i have so far.
With Me.ListBox1
.RemoveItem .ListIndex
End With

--
Though daily learning, I LOVE EXCEL!
Jennifer





All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com