MyTetra Share
Делитесь знаниями!
массив из указанного файла(листа)
16.03.2019
23:43
Раздел: !Закладки - VBA - Array

''===================================================================================================

''##### массив из указанного листа

''

''--------------------------------------------------------------------------------------------------

'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 = "I:\0ru_di\Peinture\TPM\07_QUALITE_PEINT\01_STATISTICS\07_SSAR.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 = "I:\0ru_di\Peinture\TPM\07_QUALITE_PEINT\01_STATISTICS\07_SSAR.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

'===================================================================================================

Так же в этом разделе:
 
MyTetra Share v.0.52
Яндекс индекс цитирования