| 
    
     |  | すみません 先ほどのコードに誤りがありました
 
 訂正します
 下記が正しいほうです
 
 よろしくお願いします
 
 
 >Sub test()
 >
 >Dim LastR As Integer, MyRow As Integer
 >Dim Sh1 As Worksheet
 >Dim MyRange As Range
 >Dim strParts As String
 >Dim strDir As String, MyTxt As String
 >
 >
 >Set Sh1 = Worksheets("シート1")
 >
 >LastR = Sh1.Range("A65536").End(xlUp).Row
 >
 >Set MyRange = Sh1.Range("A1:A" & LastR).Find(what:="R", lookin:=xlValues)
 > If Not MyRange Is Nothing Then
 >  MyRow = MyRange.Row
 >  strParts = ShBOM.Range("B" & MyRow).Value
 >  strDir = "C:\Temp\フォルダ\"
 >
 >  If Dir(strDir & "QQQ_" & strParts & "*AS.txt") <> "" Then
 >   'ファイルがあったら、テキストデータを開く
 >   Open strDir & "QQQ_" & strParts & "*AS.txt" For Input as #1
 >
 >   End If
 > End If
 >
 >End Sub
 
 |  |