Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default rETRIEVING DATA FROM EXCEL WORKSHEET TO CONTROLS IN USERFORM

hi! I have a userform with a texbox control where a user can input an ID no.
what i want is that when the length of textbox = 4 it will automatically
search that number in a worksheet STUDENT PROFILE which has the ff. fields:
ID no., lname, fname, mname, and addr. if that number is found its
corresponding lname, fname, mname, and addr. will be displayed in the
texboxes in that userform such as txtlname, txtfname, txtmname, and txtaddr.
I hope you'll help me. Thanks in advance...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default rETRIEVING DATA FROM EXCEL WORKSHEET TO CONTROLS IN USERFORM

Rather than getting fancy and having the macro launch automatically when the
ID length reaches 4, just add a button that runs a search and fill macro.
You can record a macro to get the basics of the find command. Then, tailor
it a bit. The following will give you some ideas:

Dim cell As Range
Set cell = Nothing
With Workbooks("my workbook.xls").Sheets("Sheet1")
Set cell = .Columns("A:A").Find(What:="1234", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not cell Is Nothing Then
userform1.Textbox1.Text = .Cells(cell.Row, 2).Value
'additional code to populate form
Else
MsgBox "No match found"
End If
end with

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Chinx21" . wrote in message
...
hi! I have a userform with a texbox control where a user can input an ID
no.
what i want is that when the length of textbox = 4 it will automatically
search that number in a worksheet STUDENT PROFILE which has the ff.
fields:
ID no., lname, fname, mname, and addr. if that number is found its
corresponding lname, fname, mname, and addr. will be displayed in the
texboxes in that userform such as txtlname, txtfname, txtmname, and
txtaddr.
I hope you'll help me. Thanks in advance...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default rETRIEVING DATA FROM EXCEL WORKSHEET TO CONTROLS IN USERFORM

Set cell = .Columns("A:A").Find(What:="1234", After:=ActiveCell,
LookIn:=xlFormulas, _

can i use the (What:=txtidnum.text), in the Find(What:="1234",
thanks!

"Bob Flanagan" wrote:

Rather than getting fancy and having the macro launch automatically when the
ID length reaches 4, just add a button that runs a search and fill macro.
You can record a macro to get the basics of the find command. Then, tailor
it a bit. The following will give you some ideas:

Dim cell As Range
Set cell = Nothing
With Workbooks("my workbook.xls").Sheets("Sheet1")
Set cell = .Columns("A:A").Find(What:="1234", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not cell Is Nothing Then
userform1.Textbox1.Text = .Cells(cell.Row, 2).Value
'additional code to populate form
Else
MsgBox "No match found"
End If
end with

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Chinx21" . wrote in message
...
hi! I have a userform with a texbox control where a user can input an ID
no.
what i want is that when the length of textbox = 4 it will automatically
search that number in a worksheet STUDENT PROFILE which has the ff.
fields:
ID no., lname, fname, mname, and addr. if that number is found its
corresponding lname, fname, mname, and addr. will be displayed in the
texboxes in that userform such as txtlname, txtfname, txtmname, and
txtaddr.
I hope you'll help me. Thanks in advance...




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
Retrieving data into worksheet from another worksheet in same work Tasha Excel Discussion (Misc queries) 2 August 6th 09 03:51 PM
Excel worksheet retrieving data from Access [email protected] Links and Linking in Excel 1 May 8th 06 12:32 AM
Userform: listbox and controls' data entry validation sebastienm Excel Programming 2 September 15th 05 02:02 PM
Comparing & Retrieving Data From other worksheet cba321 Excel Programming 0 November 4th 04 09:32 AM
Retrieving previously entered userform data from saved spreadsheet WillRn Excel Programming 1 August 10th 04 07:45 PM


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

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

About Us

"It's about Microsoft Excel"