Thanks JLatham,I know how to build a userform,but I am a beginner in adding a
code to a userform.I have designed a userform with 2 textboxes('search
textbox','result textbox'),1 command button('search'),1 listbox('search
results').When a user enters 3 letters in 'search textbox' and click on cmd
button 'search' ,cmdbutton click event will call an array formula {IF(ROWS($1:
1)<=COUNTIF(A$2:A$1200,'search textbox'.text),INDEX(A$2:A$1200,SMALL(IF(LEFT
(A$2:A$1200,3)='search textbox'.text,ROW(A$2:A$1200)-ROW(A$2)+1, ROWS($1:1))),
" ") , and the results of this formula be put in 'search results' listbox.
On listbox.list click event 'result textbox' will display one result from
'search result'.text. This is a tough task for me.I do understand from ur
answer how to call a function.How to do my tough task. Many thanks in
anticipation.
JLatham wrote:
Assumes a UserForm with 2 controls on it - a command button and a label.
Clicking the command button will call a function to multiply a value by 10
and put the results into the label:
Private Sub CommandButton1_Click()
Me!Label1.Caption = MultiplyBy10(40)
End Sub
Function MultiplyBy10(Quantity As Integer) As Long
MultiplyBy10 = Quantity * 10
End Function
Some controls have .Caption property, some others use .Text, depends on the
control.
I presume you know how to start building a userform and how to put controls
on it? Once you've got the controls in place, right click on the command
button and choose View Code to start adding code to its _click event.
how to call a function on control click event and put the function result on
another control. in userform.
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200608/1