.Find Help

Alteran

Board Regular
Joined
Nov 25, 2009
Messages
117
I am trying to use .find to find a row and pull the information from it to a user form, however because there is formulas in the row I am looking in its not finding the value i need can anyone help?

This is the code I have done so far:
Code:
Private Sub cbLoad_Request_Click()
Dim TravelFound As Range
With Range("TravelItems")
    Set TravelFound = .Find(tbTRID.Value)
    If TravelFound Is Nothing Then
        MsgBox ("Travel request does not exist!")
        tbTRID.Value = ""
        Exit Sub
    Else
        With Range(TravelFound.Address)
            ddDir = .Offset(0, 2)
            ddTType = .Offset(0, 3)
            ddCC = .Offset(0, 4)
            ddOPSC = .Offset(0, 5)
            tbEName = .Offset(0, 6)
            tbStartD = .Offset(0, 7)
            tbEndD = .Offset(0, 8)
            tbLocation = .Offset(0, 10)
            tbName = .Offset(0, 11)
            tbClass = .Offset(0, 12)
            tbEorC = .Offset(0, 13)
            tbECost = .Offset(0, 14)
            tbJustification = .Offset(0, 15)
            tbSTComments = .Offset(0, 16)
            ddST = .Offset(0, 18)
            ddIA = .Offset(0, 20)
            ddTStatus = .Offset(0, 22)
            tbSTDate = .Offset(0, 19)
            tbIABDate = .Offset(0, 21)
            tbTDate = .Offset(0, 23)
            tbAddition = .Offset(0, 17)
        End With
    End If
End With
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try

Code:
Set TravelFound = .Find(what:=tbTRID.Value, LookIn:=xlValues, lookat:=xlWhole)
 
Upvote 0
I am still getting the travel does not exist error, so its not finding it, and I picked one from the list. I know if I go into the sheet and use the find command in excel and set it to values it will find it when I use the form, however Its not just me who would be using the user form.
 
Upvote 0
Is tbTRID a date by any chance? If so you'll need to convert it using CDate or cLng.
 
Upvote 0
tbTRID is a number for example: 6.012

The named Range TravelItems =Rollup!$A:$A

Which is a secondary sheet from the one the form opens from.

I have tried using:
Code:
.Find(what:=tbTRID.Value, LookIn:=xlValues, LookAt:=xlPart)

which will return some values but they seem to be from the wrong sheet.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,848
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top