How to locate a specific Tag whose position is not same in each excel files and read the measured value column for that specific tag

charger

New Member
Joined
Jul 29, 2013
Messages
2
I have multiple Excel files for a particular part number which I have narrowed down to few 100s by my search macro, but in those found files my search also needs to look for a particular <code>id tag</code>.
Let me explain it, each Excel file having name as part number has information about measurement features of that part . These measured features are represented as different <code>id tags</code>, these tags represent different dimensions of a product, for example, in an Excel file there might be <code>D0,D1,D2,D3</code> to <code>D100</code> ID tag and it's not compulsory that every Excel file should have all the tags, in some files there won't be <code>D0</code> or <code>D1</code>, for example and the position of the tag, i.e. <code>D0</code>, will not always be in the same exact row.
So how do I write code which performs two functions:
First, to analyse the file if the <code>id tag</code> is present in it or not. Second, if present, locate the <code>id tag</code> and read the measured value column next to it and render result.
I have researched, but found that you could read an Excel file only if the data is in a fixed column in each file. No one discussed locating data within excel and finding the right thing that you are looking for and then reading the file. I want to look into the files narrowed by my search code for the ID tag and if the ID tag is present then read the data in a column next to it called as measured value and write it in a table. The data will remain in the same column but the row might not be the same for example If a sheet has tag D0 at location (B,10) it is not necessary that rest all excels would have D0 at (B,10). instead they might be at (B,80) or it might even not be there in the sheet. but if D0 is present there the only fixed thing is (B, This part can change). so the column will always be B which needs to be read but the Row might change . so before picking up the data we need to be sure that the data belongs to Id tag D0 or other wise it might pick up some other tags data and render it as result
Kindly help.



<tbody>
</tbody>
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Private Sub cmdsubmit_Click()

If Me.PART_NUMBER.Value = "" Then
MsgBox "Please enter the Part Number.", vbExclamation, "PART SEARCH"
Me.PART_NUMBER.SetFocus
Exit Sub
End If

If Me.ID_TAG.Value = "" Then
MsgBox "Please Select a ID TAG.", vbExclamation, "PART SEARCH"
Me.ID_TAG.SetFocus
Exit Sub
End If
Call flist

End Sub

Sub flist()


Dim myList
Dim fldr As String, fltr As String, sTemp As String, sHldr As String
Dim i As Long
Dim msg As String



fldr = "C:\Users\op\Desktop\New folder"
If Right$(fldr, 1) <> "\" Then fldr = fldr & "\"
fltr = (Me.PART_NUMBER.Value & "*.xls")


sHldr = Dir(fldr & fltr)
Do While sHldr <> ""
sTemp = sTemp & "|" & sHldr
sHldr = Dir
Loop
If sTemp <> "" Then
myList = Split(sTemp, "|")
For i = 1 To UBound(myList)

Next i
Else
msg = msg & vbLf & "None"
End If



End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,408
Members
449,448
Latest member
Andrew Slatter

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