Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Get_Formula(ce As Range) As String
- If ce.HasFormula Then
- Get_Formula = CStr(ce.FormulaLocal)
- Else
- Get_Formula = "Not formula exist!"
- End If
- End Function
- Function Sh_Exist(wb As Workbook, sName As String) As Boolean
- Dim wsSh As Worksheet
- On Error Resume Next
- Set wsSh = wb.Sheets(sName)
- Sh_Exist = Not wsSh Is Nothing
- End Function
- Sub ShowGetOpenDialod()
- Dim avFiles
- checkpath = ""
- Application.EnableEvents = False
- Application.ScreenUpdating = False
- If Right(checkpath, 1) <> "\" Then
- checkpath = checkpath & "\"
- End If
- checkname = Dir(checkpath & "test.xlsx")
- Sheet_work = "output"
- k = 1
- ' Excel(xls,xlsx,xlsm,xlsb)
- avFiles = Application.GetOpenFilename _
- ("Excel files(*.xlsx*),*.xlsx*", 1, "Choose Excel", , True)
- If VarType(avFiles) = vbBoolean Then
- Exit Sub
- End If
- 'avFiles - string format
- 'MsgBox "Choosen file: '" & avFiles & "'", vbInformation, "www.excel-vba.ru"
- For Each x In avFiles
- Workbooks.Open Filename:=(x)
- Workbooks(checkname).Sheets(Sheet_work).Cells(k, 1).Value = Dir(x)
- Workbooks(checkname).Sheets(Sheet_work).Cells(k, 2) = (Get_Formula(Workbooks(x).Sheets("Validation").Range("E3")))
- Workbooks(checkname).Sheets(Sheet_work).Cells(k, 3) = (Get_Formula(Workbooks(x).Sheets("Validation").Range("E4")))
- Workbooks(checkname).Sheets(Sheet_work).Cells(k, 4) = (Get_Formula(Workbooks(x).Sheets("Validation").Range("E5")))
- Workbooks(Dir(x)).Close
- k = k + 1
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement