Retrieve enterd with userform

R

Raul1960

Hello Everybody!!
I desperately need your help. I have been working with this project for weeks
and can not figure it out. I bought books looked on the internet and unable
to find what I need, So I am asking for your help.
I have created UserForm with approximately 20 entries, ie:, File#, Name,
Address……, this works fine at entering the info. My problem is, that I would
like to retrieve the same data entered by File# (which is unique), by name,
or by other unique info, and to see it (if possible) in the same Userform
that I entered this data. All the data entered are in rows, so all the info
need for a File# are in this row. Can anyone PLEASE help me with a code to
retrieve this info.

Raul
 
J

john

post the code you already have behind the form - this will give us all better
idea what you are trying to do.
 
P

Patrick Molloy

i imagine that the data is on a worksheet and in a table
use MATCH() to get the row number that corresponds to the item, then you can
use offset to get the other bits.

without seeing your code, this is difficult

I'll demonstrate. Assume a table at A1. A is the colun with the file# and
there are n columns
I'll assume that your userform has a text box (txtFieNum) holding th efile#
you want

This code will be in the userforms code sheet

WITH Worksheets("sheet1")
' get the row
myRow = WorksheetFunction.Match(txtFileNum, .Range("A:A"),False)
' note - raises an error if not found, so yuo may need to handle it
'now populate the userform controls...
for colIndex = 2 to n
cntrl(index) = .Cells(myRow, colIndex)
next
'
END WITH

the for...next you can replace by directly codeing
txtbox1 = .Cells(myrow,2)
txtbox2 = .Cells(myrow,3)

note the .
we're in the worksheet object, so the . indicates a method/property of this
sheet object. Leave off the .'s can lead to interesting stuff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top