Здравствуйте! подскажите пожалуйста как мне обращаться не к определенному файлу(как в моем случае "Проверка" ),а к любому файлу из общей папки либо же множественный выбор?
| Код |
|---|
Private Sub CommandButton3_Click()
Dim Period As String
Dim FoundPeriod As Range
Dim iSebest As String
Dim FoundSebest As Range
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim Sht As Worksheet
Dim Wb_покупки As Workbook
Set Wb_покупки = Workbooks("Проверка")
With Wb_покупки
For j = 1 To 8
Period = Split(.Cells(1, j), "-")(0)
iSebest = Split(.Cells(1, j), "-")(1)
n = 0
For Each Sht In .Worksheets
With Sht
Set FoundPeriod = .Rows(1).Find(Period, , xlValues, xlWhole)
Set FoundSebest = .Columns(1).Find(iSebest, , xlValues, xlWhole)
Cells(2 + n, j) = .Cells(FoundSebest.Row, FoundPeriod.Column)
End With
n = n + 1
Next
Next j
End With
End Sub
|
Изменено: - 12.10.2015 09:41:51