Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search a column to match textbox value from a form

Hi Guys,

I have designed a userform so that if a customer has called in before I need
to view certain fields of their previous interaction. I have a textbox
"Customer ID" which I would like to searchh through a worksheet find that ID
# then populate the corresponding previous information.

Any ideas.

Regards
Albert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Search a column to match textbox value from a form

Would you like to tell us a little bit about your user form? Like, are you
using labels, textboxes, list boxes or comboboxes to display the data that
you call from your worksheet. And how about the layout of the worksheet? Is
it designed so that the individual data elements that you intend to retrieve
can be easily accessed?
I have a program where I retrieve about ten data elements. I have them
arranged in columns so that all elements for a single call are on one row.
That allows me to not only locate them easily, but to also select them
individually for corrections. You can call them up by using the Find method,
in your case it would be by ID#. Then use Offset to access the individual
columns of data. To put the data in the form, if you use labels, Label1 =
ID#.Offset(0, 2). If you have five elements to populate you can use a loop
with a variable to get all five in one search.

For i = 1 To 5
Label & i = ID#.Offset(0, i)
Next

Maybe this will get you started.

"Albert" wrote:

Hi Guys,

I have designed a userform so that if a customer has called in before I need
to view certain fields of their previous interaction. I have a textbox
"Customer ID" which I would like to searchh through a worksheet find that ID
# then populate the corresponding previous information.

Any ideas.

Regards
Albert

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search a column to match textbox value from a form

Hi,

I have set my spreadsheet out exactly like that. My form has individual
textboxs for each datafield. Is there any way you can present it in a table
or is this the best way?

I am still not sure how to find and select the ID# in the ID# column, so
that the offset function can work? I know I should use the findmethod but am
not sure what the code is for this as it will have to loop through each cell
in the column until it finds the matching ID# or ends when the last cell is
blank.

Also do you perhaps know how 4 users (using the same spreadsheet format and
form) can write and query a closed master list excel file. This is the
combined 4 users output?

Most appreciatted.
Albert

"JLGWhiz" wrote:

Would you like to tell us a little bit about your user form? Like, are you
using labels, textboxes, list boxes or comboboxes to display the data that
you call from your worksheet. And how about the layout of the worksheet? Is
it designed so that the individual data elements that you intend to retrieve
can be easily accessed?
I have a program where I retrieve about ten data elements. I have them
arranged in columns so that all elements for a single call are on one row.
That allows me to not only locate them easily, but to also select them
individually for corrections. You can call them up by using the Find method,
in your case it would be by ID#. Then use Offset to access the individual
columns of data. To put the data in the form, if you use labels, Label1 =
ID#.Offset(0, 2). If you have five elements to populate you can use a loop
with a variable to get all five in one search.

For i = 1 To 5
Label & i = ID#.Offset(0, i)
Next

Maybe this will get you started.

"Albert" wrote:

Hi Guys,

I have designed a userform so that if a customer has called in before I need
to view certain fields of their previous interaction. I have a textbox
"Customer ID" which I would like to searchh through a worksheet find that ID
# then populate the corresponding previous information.

Any ideas.

Regards
Albert

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Search a column to match textbox value from a form

Syntax correction.

Label1.Caption = ID#.Offset(0, 2).Value

"Albert" wrote:

Hi Guys,

I have designed a userform so that if a customer has called in before I need
to view certain fields of their previous interaction. I have a textbox
"Customer ID" which I would like to searchh through a worksheet find that ID
# then populate the corresponding previous information.

Any ideas.

Regards
Albert

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Search a column to match textbox value from a form

Albert,

Put a commandbutton on your userform, with code like

Private Sub CommandButton1_Click()
Dim myC As Range
Set myC = Worksheets("Sheet1").Range("A:A").Find(UserForm1.T extBox1.Text)
If myC Is Nothing Then
Msgbox UserForm1.TextBox1.Text & " was not found."
Else
Userform1.TextBox2.Text = myC(1,2).Value 'Pick up the cell to the right of the ID#
Userform1.TextBox3.Text = myC(1,3).Value 'Pick up the cell two to the right of the ID#
End If
End Sub

You cannot have a textbox named "Customer ID" since that is an illegal name....

HTH,
Bernie
MS Excel MVP


"Albert" wrote in message
...
Hi Guys,

I have designed a userform so that if a customer has called in before I need
to view certain fields of their previous interaction. I have a textbox
"Customer ID" which I would like to searchh through a worksheet find that ID
# then populate the corresponding previous information.

Any ideas.

Regards
Albert





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search a column to match textbox value from a form

Thanks works perfectly.

Would you know how 4 users, using the same worksheet format and form, can
get their worksheet automatically updated to a closed spreadsheet and also
access data from the master if it is closed?

"Bernie Deitrick" wrote:

Albert,

Put a commandbutton on your userform, with code like

Private Sub CommandButton1_Click()
Dim myC As Range
Set myC = Worksheets("Sheet1").Range("A:A").Find(UserForm1.T extBox1.Text)
If myC Is Nothing Then
Msgbox UserForm1.TextBox1.Text & " was not found."
Else
Userform1.TextBox2.Text = myC(1,2).Value 'Pick up the cell to the right of the ID#
Userform1.TextBox3.Text = myC(1,3).Value 'Pick up the cell two to the right of the ID#
End If
End Sub

You cannot have a textbox named "Customer ID" since that is an illegal name....

HTH,
Bernie
MS Excel MVP


"Albert" wrote in message
...
Hi Guys,

I have designed a userform so that if a customer has called in before I need
to view certain fields of their previous interaction. I have a textbox
"Customer ID" which I would like to searchh through a worksheet find that ID
# then populate the corresponding previous information.

Any ideas.

Regards
Albert




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and match two colums give third column result [email protected] Excel Discussion (Misc queries) 3 November 18th 08 11:09 PM
Search, Match, And return corresponding column value sayerplayer Excel Worksheet Functions 0 February 13th 08 04:15 PM
Search Column, If match found then add two values. [email protected] Excel Programming 2 March 21st 07 09:33 AM
search column, hyperlink, offset, substitute, match (omg) nastech Excel Discussion (Misc queries) 13 July 13th 06 09:58 PM
is there a way to search with vlookup to match more than 1 column puppy Excel Discussion (Misc queries) 7 June 30th 05 07:41 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"