Excel VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have created a form using vba in excel to input data into the database.
I have also managed to delete, using the multi-list form to select and
delete a database.
Using VBA:
Is there a way where i can create a form to search that have a criteria, for
eg. i type "H" to find names starting with "H".
AND
Is there a way i can create a form where i can EDIT the data that is already
in the database.


THANK YOU SOOO MUCH.
 
Sure.

You can loop through the database range and look for your criteria. Then if you
find it, you can add it to the listbox.

dim myCell as range
dim myRng as range

with worksheets("dbworksheetnamehere")
set myrng = .range("a2:x" & .cells(.rows.count,"A").end(xlup).row
end with

with me.listbox9999
.clear
for each mycell in myrng.columns(4).cells '(say)
if lcase(mycell.value,1) = lcase(whereeveryoustoredthatchar) then
.additem mycell.value
end if
next mycell
end with

===
not tested, not compiled.
 
Back
Top