Load TextBox With Search Result Cell From a PAge

G

gwoodby

When running this It should look for StrName, Then Go 1 box over
(Column b) and Return the data in that cell to FormLoad.TxtRatRecd3
However it Just Stays Blank, any idea why?


Private Function TPRLoad(StrName As String)
FormLoad.TxtCaseName3 = StrName
Dim C As Range
FormLoad.LblName = " TPR Sheet "
FormLoad.MultiPage1.Value = 2

Set C = Range("A6:AX4500").Find(FormLoad.TxtCaseName3,
LookIn:=xlValues)
If Not C Is Nothing Then
FormLoad.TxtRatRecd3 = C.Offset(0, 1)
End If
End Function

Here is the code Used to Call the Function

Private Sub Found(StrNameFound As String)
Dim sh As Worksheet
Set sh = ActiveSheet
If sh.Name = "Shelter" Then
ShelterLoad (StrNameFound)
ElseIf sh.Name = "Dependency" Then
DependencyLoad (StrNameFound)
ElseIf sh.Name = "TPR" Then
TPRLoad (StrNameFound)
End If
End Sub
 
T

Tom Ogilvy

since the code only writes a value if it passes an if test, one would have to
assume that the if test was not passed and the Find command was not
successful. Since you don't have all the arguments specified, it is possible
the defaults are causing the problem.


Turn on the macro recorder

Select the range to search

Manually use Edit=>Find to find the value.

Assuming your are successful, turn off the macro recorder and look at the
arguments for the find command that were recorded. Include all those
arguments in your code.
 
G

gwoodby

since the code only writes a value if it passes an if test, one would have to
assume that the if test was not passed and the Find command was not
successful. Since you don't have all the arguments specified, it is possible
the defaults are causing the problem.

Turn on the macro recorder

Select the range to search

Manually use Edit=>Find to find the value.

Assuming your are successful, turn off the macro recorder and look at the
arguments for the find command that were recorded. Include all those
arguments in your code.

--
Regards,
Tom Ogilvy









- Show quoted text -

What i was doing was Testing From A6 and the text was in a5 :( ty for
the help!!!
 

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