ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   immediate help please (https://www.excelbanter.com/excel-programming/309013-immediate-help-please.html)

programmer_int[_2_]

immediate help please
 
i am now able to insert data in an excel spread sheet using a user for
thanks to Tom Ogilvy, but i also need to update and delete dat
sometimes from the excel spreadsheet using user forms....for example
want to update or delete a row where employee id=100

please help me, i need to solve this problem immedaitel

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


Tom Ogilvy

immediate help please
 
Assume you have a combobox that lists employee ID's (combobox1) and a
button named cmd_DeleteChoice that when pushed, you want to delete the
employee-id selected in combobox1.

Assume Empoyee data is in a sheet named DATA and the employee ID's start in
A2 with contiguous entries to the last employee.

Private Sub Userform_Initialize()
Dim rng as Range
With Worksheets("Data")
set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown))
end with
Combobox1.List = rng
End Sub

Private Sub Cmd_DeleteChoice()
Dim rng as Range
With Worksheets("Data")
set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown))
end with
if combobox1.ListIndex < -1 then
rng(Combobox1.ListIndex+1).EntireRow.Delete
' now reset combobox1 list
With Worksheets("Data")
set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown))
end with
Combobox1.List = rng.Value
end If
End sub

--
Regards,
Tom Ogilvy

"programmer_int " wrote in
message ...
i am now able to insert data in an excel spread sheet using a user form
thanks to Tom Ogilvy, but i also need to update and delete data
sometimes from the excel spreadsheet using user forms....for example i
want to update or delete a row where employee id=100

please help me, i need to solve this problem immedaitely


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





All times are GMT +1. The time now is 07:36 PM.

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