DebtAcquisitions

New Member
Joined
May 20, 2015
Messages
21
Hello Everyone, thanks for taking a look at my question.

I need to create a macro that will "check" if a file contains certain heater information.

Row 1 (sheet: File) contains header info example: FirstName, LastName, PhoneNumber.....

however, sometimes these are in the wrong order or are missing completey.


I have another sheet (Data) that contains possible data in a column.
Example for first name (column B) the header can contain:

Firstname, FName, F Name, and so on....


for now, I just want a msgbox to tell me something was found, I will add the correct code after I figure this out.


Below is a sample of the code I have created so far...

Sub NameTest()
' This is a working version as long as you identify exactly what to look for.

Dim myCol As Long, rngFound As Range


'Fname = "1"
Fname = Workbooks("IntChk.xlsm").Worksheets("Data").Range("B3")
'Fname = Workbooks("IntChk.xlsm").Worksheets("Data").Range("B:B")

Set rngFound = Worksheets("File").Rows(1).Find(What:=Fname, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)

If Not rngFound Is Nothing Then
myCol = rngFound.Column
MsgBox myCol
Else
MsgBox "Not Found"
End If


End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
So.. to recap.

I am looking for a way I can use the data in the column of 'Data' sheet to search the entire row of 'File' to see if the data in the column can be found in the row..... it would be nice for the msgbox to populate the column the data was found or just note if nothing was found....

hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,580
Members
449,039
Latest member
Arbind kumar

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