| 
    
     |  | ▼Jaka さん: 
 下記のようにコードを記述してみましたが、どうしても、変数の値が "" となってしまい、取得できません。
 
 書き方が間違っているのでしょうか?
 何度もすみませんがよろしくお願いします
 
 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, 変数 As String
 
 
 Set Sh1 = Worksheets("シート1")
 
 LastR = Sh1.Range("D65536").End(xlUp).Row
 
 Set MyRange = Sh1.Range("A10:A" & LastR).Find(what:="R", lookin:=xlValues)
 If Not MyRange Is Nothing Then
 MyRow = MyRange.Row
 strParts = Sh1.Range("D" & MyRow).Value
 strDir = "C:\Temp\フォルダ\"
 
 変数 = Dir(strDir & "QQQ_" & strParts & "*AS.txt")
 
 ↑どうしても変数の値が""となってしまいます
 
 
 If 変数 <> "" Then
 Open strDir & 変数 For Input as #1
 
 End If
 End If
 
 
 End Sub
 
 |  |