|
|||||||
массив из указанного файла(листа)
Время создания: 16.03.2019 23:43
Раздел: Разные закладки - VBA - Array
Запись: xintrea/mytetra_db_adgaver_new/master/base/1529314508ocgtvnsuvn/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
''=================================================================================================== ''##### массив из указанного листа '' ''-------------------------------------------------------------------------------------------------- 'Function Загрузка_массива(ByVal oSh As Worksheet, _ ' Optional iNbRowStart As Long = 1, _ ' Optional iNbClnStart As Long = 1, _ ' Optional iNbClnFindRowEnd As Long = 1) As Variant ' '' iNbClnFindRowEnd - столбец в котором ищем последнюю строку 'Dim iNbRowEnd As Long 'Dim iNbClnEnd As Long ' With oSh ' iNbClnEnd = .Cells(iNbRowStart, 256).End(xlToLeft).Column ' iNbRowEnd = .Columns(iNbClnFindRowEnd).Rows(65536).End(xlUp).Row ' ''''.Cells(iNbRow, 1).Resize(UBound(aTemp), UBound(aTemp, 2)) = aTemp ' Загрузка_данных2 = Range(.Cells(iNbRowStart, iNbClnStart), .Cells(iNbRowEnd, iNbClnEnd)).Value '' .Range(strRange).Copy Destination:=ThisWorkbook.Sheets("ListPJI").Cells(1, 1) ' End With '' Application.CopyMode = False 'End Function '=================================================================================================== 'sFile = "<path_to_folder_or_file>.xlsx" 'sShName = "SuiviAr" 'sShName = "Prod_TCM" '=================================================================================================== '#####Открытие (назначение) файла ' '-------------------------------------------------------------------------------------------------- Function FnFileOpen(ByVal strFileName As String) As Workbook Set FnFileOpen = Workbooks.Open(Filename:=strFileName, ReadOnly:=True) End Function '=================================================================================================== '=================================================================================================== '#####массив из указанного файла ' Sub test_Загрузка_данных2() sFile = "<path_to_folder_or_file>.xlsx" 'sShName = "SuiviAr" 'sShName = "Prod_TCM" t = Timer aTemp = Загрузка_данных2(sFile, 1) Debug.Print UBound(aTemp) & " - " & UBound(aTemp, 2) Debug.Print Timer - t End Sub '-------------------------------------------------------------------------------------------------- Function Загрузка_данных2(ByVal strFullPath As String, _ Optional ByVal intSh As Integer = 1) As Variant Dim oWb As Workbook Dim iNbCln As Long Dim iNbRow As Long ' ThisWorkbook.Sheets("ListPJI").Cells.Clear Set oWb = FnFileOpen(strFullPath) With oWb.Sheets(intSh)
iNbCln = .Cells(1, 256).End(xlToLeft).Column ' hh = .RowsCount iNbRow = .Columns(1).Rows(1048576).End(xlUp).Row ''''.Cells(iNbRow, 1).Resize(UBound(aTemp), UBound(aTemp, 2)) = aTemp Загрузка_данных2 = Range(.Cells(2, 1), .Cells(iNbRow, iNbCln)).Value ' .Range(strRange).Copy Destination:=ThisWorkbook.Sheets("ListPJI").Cells(1, 1) ' Application.CopyMode = False End With oWb.Close ' Set oWb = Nothihg End Function '=================================================================================================== |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|