ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update (https://www.excelbanter.com/excel-programming/290341-update.html)

Robert Couchman[_4_]

Update
 
Hello,

can anyone help, i am looking for a piece of code that can
be used as a update text box.

i have 3 text boxes and a list box, what i want is so
that if a value is typed into one of the boxes it will
list the related information in the list box,

i.e. if a person types 'Rob' in the middle text box (name
box)
then the list box will produce a list where all the values
in the name column begin with 'Rob', and then using the
offset command (unless others are better) it will display
all the relevant information.

i could then manipulate the code so that if a value is
typed into another field that is incorrect or does not
appear in that column then the results would disapear, or
if the correct data is entered it will narrow the
selection more.

Thank you for all help,

Robert Couchman

Tom Ogilvy

Update
 
Listbox1.Clear
With worksheets("Data")
set rng = .Range(.Cells(2,5),.Cells(2,5).End(xldown))
End with
for each cell in rng
if instr(1,cell,Textbox2.Text,vbTextCompare) then
listbox1.AddItem cell.Value
end if
Next


--
Regards,
Tom Ogilvy

"Robert Couchman" wrote in message
...
Hello,

can anyone help, i am looking for a piece of code that can
be used as a update text box.

i have 3 text boxes and a list box, what i want is so
that if a value is typed into one of the boxes it will
list the related information in the list box,

i.e. if a person types 'Rob' in the middle text box (name
box)
then the list box will produce a list where all the values
in the name column begin with 'Rob', and then using the
offset command (unless others are better) it will display
all the relevant information.

i could then manipulate the code so that if a value is
typed into another field that is incorrect or does not
appear in that column then the results would disapear, or
if the correct data is entered it will narrow the
selection more.

Thank you for all help,

Robert Couchman




Robert Couchman[_4_]

Update
 
Thank you Tom,

but under what Private sub should i call this feature?
i usualy try _afterupdate()
also where would this usualy be best placed?
i would think textbox2_afterupdate looking at the
procedure!

Thank you,

Robert Couchman

-----Original Message-----
Listbox1.Clear
With worksheets("Data")
set rng = .Range(.Cells(2,5),.Cells(2,5).End(xldown))
End with
for each cell in rng
if instr(1,cell,Textbox2.Text,vbTextCompare) then
listbox1.AddItem cell.Value
end if
Next


--
Regards,
Tom Ogilvy


Tom Ogilvy

Update
 
That sounds good to me.

--
Regards,
Tom Ogilvy

"Robert Couchman" wrote in message
...
Thank you Tom,

but under what Private sub should i call this feature?
i usualy try _afterupdate()
also where would this usualy be best placed?
i would think textbox2_afterupdate looking at the
procedure!

Thank you,

Robert Couchman

-----Original Message-----
Listbox1.Clear
With worksheets("Data")
set rng = .Range(.Cells(2,5),.Cells(2,5).End(xldown))
End with
for each cell in rng
if instr(1,cell,Textbox2.Text,vbTextCompare) then
listbox1.AddItem cell.Value
end if
Next


--
Regards,
Tom Ogilvy




Robert Couchman[_4_]

Update
 
Any idea of how to get more than 1 text box to edit the
data in the list?

I.e. you type "Rob" in textbox1 and "Couch" in textbox2
and the list will produce th results "Robert Couchman"?

i can get the list to display the full data in more than 1
cell,
e.g. i type "rob" and it will list all cells with "rob" in
and also the following cells "Robert Couchman"

Thank you,

Robert Couchman

Tom Ogilvy

Update
 
Assume Robert Couchman is all in one cell:

Listbox1.Clear
With worksheets("Data")
set rng = .Range(.Cells(2,5),.Cells(2,5).End(xldown))
End with
for each cell in rng
if instr(1,cell,Textbox1.Text,vbTextCompare) and _
instr(1,cell,Textbox2.Text,vbTextCompare) then
listbox1.AddItem cell.Value
end if
Next

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Listbox1.Clear
With worksheets("Data")
set rng = .Range(.Cells(2,5),.Cells(2,5).End(xldown))
End with
for each cell in rng
if instr(1,cell,Textbox2.Text,vbTextCompare) then
listbox1.AddItem cell.Value
end if
Next


--
Regards,
Tom Ogilvy

"Robert Couchman" wrote in message
...
Hello,

can anyone help, i am looking for a piece of code that can
be used as a update text box.

i have 3 text boxes and a list box, what i want is so
that if a value is typed into one of the boxes it will
list the related information in the list box,

i.e. if a person types 'Rob' in the middle text box (name
box)
then the list box will produce a list where all the values
in the name column begin with 'Rob', and then using the
offset command (unless others are better) it will display
all the relevant information.

i could then manipulate the code so that if a value is
typed into another field that is incorrect or does not
appear in that column then the results would disapear, or
if the correct data is entered it will narrow the
selection more.

Thank you for all help,

Robert Couchman







All times are GMT +1. The time now is 02:38 PM.

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